Content changing method, electronic device, storage medium and program product
Through the server optimization of the cache strategy, the target fields that minimize the response and the change frequency threshold are obtained, which solves the problems of network bandwidth waste and delay in multi-user collaborative editing, and realizes efficient content synchronization and cache management.
Patent Information
- Application Number
- CN202510880892.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-27
AI Technical Summary
In the case of collaborative editing of multiple users, there are contradictions between content update frequency differences and unified cache mechanisms, resulting in network bandwidth waste and interaction delays, synchronization delay climbing, client rendering jitter and server resource overload.
By responding to the client's change request, obtaining the target field that minimizes the response, generating the latest version of the target file, and optimizing the cache strategy based on the target cache data and change frequency threshold, reducing invalid cache and repeated calculations, and improving synchronization efficiency.
It reduces the burden of synchronous transmission in multi-user collaborative editing scenarios, improves data transmission efficiency and synchronization consistency, and reduces network bandwidth waste and interaction delay.
Smart Images

Figure CN120371848A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to a content change method, an electronic device, a storage medium, and a program product. Background Art
[0002] In the field of modern Web application development, data interaction efficiency and content real-time synchronization capabilities are the core challenges in building complex collaboration tools (such as rich text editors, online documents, and PPT collaborative editing systems). In traditional technical solutions, the caching strategy on the server side is fixed, and there is caching of invalid data. This mode will cause waste of network bandwidth and interaction delay in high-frequency content update scenarios, seriously affecting the real-time collaboration experience of multi-terminal users. Summary of the Invention
[0003] The present disclosure provides a content change method, an electronic device, a storage medium, and a program product.
[0004] According to one aspect of the present disclosure, there is provided a content change method, including: the server responds to a change request of a target content of a target file by a first client, and obtains a target field used to change the target content in the change request; the server generates a latest version of the target file based on target cache data corresponding to the target file on the server and the target field; the server obtains a change frequency of the target content; when the change frequency is lower than a preset change frequency threshold, the server caches the target field in the target cache data to obtain updated target cache data.
[0005] The content change method according to at least one embodiment of the present disclosure further includes: the server determines a changed field of the target file in the latest version of the target file that has changed relative to a second client subscribing to the server; the server pushes the changed field to the second client, and the changed field is used to synchronize the content of the target file of the second client to the latest version.
[0006] According to the content change method of at least one embodiment of the present disclosure, the server determines the changed fields in the target file of the latest version that have changed relative to the target file of the second client, including: The server obtains the latest version number of the target file of the second client to obtain the latest version number of the second end; When the latest version number of the second end lags behind the version number of the latest version, the server queries the target file corresponding to the latest version number of the second end to obtain the target file of the second end version; The server compares the content differences between the target file of the latest version and the target file of the second end version to obtain the server content and the second client content with differences; The server compares the field differences between the server content with differences and the second client content to determine the changed fields in which the server content with differences has changed relative to the second client content.
[0007] According to the content change method of at least one embodiment of the present disclosure, the change request for the target content includes a query request for the target content; The target fields for changing the target content include the target fields for obtaining the target content; Obtaining the target fields for changing the target content in the change request includes: The server parses the query request to identify the type of the target content requested by the first client to query; The server generates the target fields for obtaining the target content based on the type of the target content.
[0008] According to the content change method of at least one embodiment of the present disclosure, it further includes: The server returns the target fields and the version number of the latest version to the first client.
[0009] According to the content change method of at least one embodiment of the present disclosure, the server generates the target file of the latest version based on the target cache data corresponding to the target file on the server and the target fields, including: The server parses the change request to obtain the first end version number of the target file of the first client; The server determines the intermediate version number based on the version difference between the server version number corresponding to the target cache data and the first end version number, and obtains the field change log of the intermediate version number; The server loads the target cache data to obtain the target file corresponding to the server version number; The server performs a field change operation on the target file corresponding to the server version number based on the field change log of the intermediate version number to obtain the target file of the first end version; The server changes the target content of the target file of the first end version based on the target fields to obtain the changed target file; The server increments the version number of the first end version as the version number of the changed target file to obtain the target file of the latest version.
[0010] The content change method according to at least one embodiment of the present disclosure further includes: when the change frequency is higher than or equal to a preset change frequency threshold, the server generates a field change log corresponding to the version number of the latest version based on the target field.
[0011] According to another aspect of the present disclosure, there is provided an electronic device, including: a memory storing execution instructions; and a processor that executes the execution instructions stored in the memory, so that the processor executes the content change method of any one of the embodiments of the present disclosure.
[0012] According to still another aspect of the present disclosure, there is provided a readable storage medium storing execution instructions, and when the execution instructions are executed by a processor, they are used to implement the content change method of any one of the embodiments of the present disclosure.
[0013] According to yet another aspect of the present disclosure, there is provided a computer program product including a computer program, and when the computer program is executed by a processor, it implements the content change method of any one of the embodiments of the present disclosure. Description of the Drawings
[0014] The drawings illustrate exemplary embodiments of the present disclosure and, together with the description thereof, are used to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are included in this specification and form a part of this specification.
[0015] Figure 1 It is a flowchart of the content change method according to an embodiment of the present disclosure.
[0016] Figure 2 It is an application schematic diagram of the content change method according to an embodiment of the present disclosure.
[0017] Figure 3 It is an application schematic diagram of the content change method according to an embodiment of the present disclosure.
[0018] Figure 4 It is a flowchart of the content change method according to an embodiment of the present disclosure.
[0019] Figure 5 It is a partial flowchart of the content change method according to an embodiment of the present disclosure.
[0020] Figure 6 It is a flowchart of the content change method according to an embodiment of the present disclosure.
[0021] Figure 7 It is a partial flowchart of the content change method according to an embodiment of the present disclosure.
[0022] Figure 8It is a schematic flowchart of a content change method according to an embodiment of the present disclosure.
[0023] Figure 9 It is a partial schematic flowchart of a content change method according to an embodiment of the present disclosure.
[0024] Figure 10 It is a schematic block diagram of the structure of a content change device according to an embodiment of the present disclosure.
[0025] Figure 11 It is a schematic block diagram of the structure of an electronic device according to an embodiment of the present disclosure. Detailed implementation manners
[0026] The present disclosure will be further described in detail below with reference to the accompanying drawings and examples. It can be understood that the specific examples described herein are only used to explain the relevant content and do not limit the present disclosure. Additionally, it should be noted that for the convenience of description, only the parts related to the present disclosure are shown in the drawings.
[0027] It should be noted that, without conflict, the embodiments in the present disclosure and the features in the embodiments can be combined with each other. The technical solutions of the present disclosure will be described in detail below with reference to the drawings and in combination with the embodiments.
[0028] In a multi-user collaborative editing scenario, the existing technical solutions generally face the contradiction between the content update frequency difference and the unified caching mechanism. As a result, when the existing system supports large-scale real-time collaboration, it causes network bandwidth waste and interaction delay, and is prone to a series of technical obstacles such as the climbing of synchronization delay, the jitter of client rendering, and the overload of server resources.
[0029] Embodiments of the present disclosure provide a content change method, which can be executed by a computer device. The content change method of the embodiments of the present disclosure is mainly used to reduce the synchronization transmission burden in a multi-user collaborative editing scenario.
[0030] Figure 1 The overall schematic flowchart of the content change method M10 according to an embodiment of the present disclosure is shown. As Figure 1 shown, the method includes steps S11 to S17.
[0031] S11. In response to a change request from a first client for the target content of a target file, the server obtains the target field used to change the target content in the change request.
[0032] See Figure 2 , in a multi-user collaborative editing scenario, the client edits the file to change the content of the target file, and the server is responsible for synchronizing the content changed by the client to obtain a new version of the target file, and synchronizing the changed content to other clients according to requirements.
[0033] In this application scenario, the first client refers to the client that sends a change request to the server. For example, in a collaborative editing scenario involving a server, Client A, Client B, and Client C, if Client A sends a change request to the server and the server executes content change method M10 based on the change request of Client A, Client A is regarded as the first client of this synchronization task. Similarly, if Client B sends a change request to the server during the next synchronization task, then Client B is regarded as the first client of the next synchronization task.
[0034] The target file is the file operated by the first client in the collaborative editing scenario. The type of the target file can be rich text, online collaborative document, online collaborative PPT, online collaborative graphic editing file, etc., which is not restricted here.
[0035] The target content refers to the content in the target file that has changed due to the operation of the first client. Among them, the change methods include generating new content, deleting existing content, and modifying existing content. Correspondingly, the change request can include requests for generating content, deleting content, and modifying content. The type of the target content can include text, pictures, charts, animations, etc. For example, assume that the first client modifies the title of a PPT file and replaces Picture 2, and sends the change request corresponding to the above change operation to the server. Then this PPT file is the target file, and the title text and Picture 2 of this PPT file are the target content.
[0036] The target field is the exact field that minimizes the response required for the target content to change. For example, text content usually includes fields such as title, text, author, and timestamp. If the change operation of the first client on the text content of the target file only involves the change of the title part, then when the server synchronizes the change operation of the first client on the text content of the target file, only the title field needs to be changed to meet the functional requirements. At this time, fields such as text, author, and timestamp are redundant fields in this change operation. Therefore, the field that minimizes the response to meet the change requirements of the target content is used as the target field in this synchronization change operation to distinguish it from the redundant fields.
[0037] In one embodiment, the server can extract target fields from the redundant data of the change request of the target content of the target file by the first client. For example, the change request of the target content of the target file by the first client includes all the data of the changed target content and the version information of the target file of the first client. Based on this, the server determines the target content before the change according to the current version of the target file of the first client, and extracts the target fields necessary for changing the target content before the change to the target content after the change from all the data of the target content, so as to obtain the target fields in the change request. In this way, the server can accurately use the target fields for the synchronization process of content change, reduce the amount of data transmitted during the synchronization process, and improve the synchronization efficiency.
[0038] In another embodiment, the first client can accurately upload the target fields for the change synchronization of the target content. For example, the change request of the target content of the target file by the first client includes the change operation log and the version information of the target file of the first client, and the change operation log includes the type of the target content to be changed, the location or range of the target file affected by the change operation, and the specific target fields of the change. In this way, the amount of data transmitted between the first client and the server can be further reduced, the network transmission burden can be reduced, and the synchronization efficiency can be improved.
[0039] S13. The server generates the target file of the latest version based on the target cache data corresponding to the target file on the server and the target fields. Among them, in the multi-user collaborative editing scenario, the target files processed collaboratively by multiple clients and the server are usually files with the same name. If the versions of the target files on different sides are exactly the same, the contents of the target files on different sides are also exactly the same; otherwise, if the versions of the target files on two sides are not exactly the same, the contents of the target files on these two sides are not necessarily the same. In the case where the first client sends a change request for the target content of the target file to the server, the server generates the target file of the latest version locally on the server based on the target fields in the change request, and then synchronizes the version of the target file of the latest version to the first client. During this process, it is necessary to generate the target file of the latest version on the server for spreading the latest version of the target file to other clients.
[0040] To quickly generate the target file, the server caches a part of the data of the target file as the target cache data corresponding to the target file on the server. In this way, when the server needs to generate the target file of the latest version, the server can return the target cache data from the memory for generating the target file of the latest version, so that this part of the data does not need to be obtained by accessing the database query, which can improve the data transmission efficiency.
[0041] Please combine Figure 3, in one embodiment, the target cache data cached by the server is the content in the target file that does not change frequently. When the server updates the version of the target file based on the target field, the server loads a part of the content of the target file based on the target cache data; then, based on the content difference between the version of the first client and the target cache data, it obtains the data from the database for supplementing the content of the target cache data to the version of the first client, so that the server loads the target file of the first client version; finally, it performs the change operation on the target field based on the target file of the first client version to obtain the target file of the latest version. For example, in Figure 3 the schematic example shown, the change operation of the target field is to change the A field in the target file of the first client version to the B field. In the process of generating the target file of the latest version, the content that does not change frequently in the target file of the latest version is loaded based on the target cache data, the target field can be obtained from the change request of the first client, and only the part of the data missing from the target cache data relative to the target file of the first client version needs to be obtained by querying the database, and the proportion of this part of the data in the target file of the latest version is relatively small. In this way, the transmission burden can be reduced and the data transmission efficiency can be improved.
[0042] S15. The server obtains the change frequency of the target content. Among them, the change frequency of the target content is used to determine whether the target content is data that does not change frequently. In one implementation, the change frequency of the target content can be obtained by statistically analyzing data such as the frequency of requests from clients to change the target content and the frequency of changes to the target content on the server. For example, the average value of the frequencies of requests from each client in the collaborative editing scenario to change the target content can be used as the change frequency of the target content, or the frequency of changes to the target content on the server can be used as the change frequency of the target content, etc., which are not limited here.
[0043] S17. When the change frequency is lower than the preset change frequency threshold, the server caches the target field in the target cache data to obtain the updated target cache data. The preset change frequency threshold is used to measure the level of the change frequency of the target content to determine whether the target content is data that does not change frequently. Please refer to Figure 3, when the version is updated, the server first loads a part of the files based on the target cache data that does not change frequently. Since the data that does not change frequently is often difficult to conflict with the same content data of other versions, when updating the part of the files loaded based on the target cache data to the target files of the latest version, the change amount of the data that does not change frequently is small, and it is rarely necessary to perform change operations on the data that does not change frequently when updating the latest version. Based on this, when the change frequency of the target content is lower than the preset change frequency threshold, the target content can be determined as the data that does not change frequently for caching, so as to be quickly loaded during the next synchronization task. On the contrary, if the data that changes frequently is cached, when updating the part of the files loaded based on the data that changes frequently to the target files of the latest version, the change amount of the data that changes frequently is large, and it is often necessary to perform change operations on the data that changes frequently again during the process of updating the latest version. Based on this, the server does not cache the data that changes frequently, so as to avoid unnecessary repeated calculations caused by performing change operations on the data that changes frequently again during the process of updating the latest version.
[0044] When the target content is determined as the data that does not change frequently, the caching of the target content is still based on the target fields of minimizing the response for caching, and the updated cache data is obtained by updating the current target cache data of the server based on the target fields. Specifically, if there is no field with the same name as the target field in the target cache data, a target field is added to the target cache data. If there is a field with the same name as the target field in the target cache data, the content of the field with the same name in the target cache data is replaced with the content of the target field. If the change request for the target field is to delete the target field, the field with the same name in the target cache data is deleted.
[0045] In summary, in the content change method of the present disclosure, when the server synchronizes the change operations of the client, the target content of the target file is changed based on the target cache data of the server and the target fields that require minimal response for the change operations, generating a target file with the changed target content as the latest version. Among them, the target cache data is used to quickly load a part of the content in the target file that is not frequently updated when generating the latest version of the target file. The amount of data change of this part of the content that is not frequently updated is small during the process of generating the latest version of the target file, which can reduce the repeated calculation of data changes. For data that changes frequently, caching is not performed because even if the data that changes frequently is cached, it is likely to change during the process of generating the latest version of the target file, resulting in the cached data not being applied to the latest version of the target file, causing ineffective caching. On this basis, when the server responds to the change request of the first client for the target content and updates the version of the target file based on the target fields, a preset change frequency threshold is used to determine whether the target content is data that does not change frequently. If the change frequency of the target content is lower than the preset change frequency threshold, it is determined that it is data that does not change frequently and is cached to update the current target cache data of the server, thereby avoiding ineffective caching of data on the basis of ensuring data transmission efficiency, and reducing the burden of repeated calculation and transmission.
[0046] In some embodiments of the present disclosure, the content change method M10 may further include step S16 as Figure 4 shown. S16: When the change frequency is higher than or equal to the preset change frequency threshold, the server generates a field change log corresponding to the version number of the latest version based on the target fields.
[0047] When the change frequency of the target content is higher than or equal to the preset change frequency threshold, the target content is regarded as data that changes frequently. For data that changes frequently, even if it is cached so that it can be quickly loaded, it is likely to change after being loaded, and ultimately it is difficult to remain in the latest version of the target file, which is equivalent to caching data that is not useful in the latest version of the target file, causing ineffective caching. Based on this, for the target content that changes frequently, the corresponding target fields are generated into a field change log, and the field change log is persistently stored in the database of the server. When it is necessary to update the version of the target file using the field change log, the server queries the database to obtain the field change log corresponding to the required version number. In this way, ineffective caching can be avoided and the occupancy of the cache space can be reduced.
[0048] Among them, the field change log is used to record information such as the type of the target content to be changed, the location or scope of the target file affected by the change operation, and the specific target field of the change. When the field change log corresponds to the version number of the latest version, it indicates that when the target file of the previous version before the latest version is updated to the latest version, the file content change at the field level can be performed according to the field change log corresponding to the version number of the latest version, so as to update the target file of the previous version before the latest version to the latest version.
[0049] In some embodiments of the present disclosure, the change request of the first client for the target content of the target file may include change requests for multiple different types of target content. For example, in one change request, it is requested to change the text content and the picture content. Correspondingly, the server performs synchronous change processing on the content using the target field corresponding to the text content and the target field corresponding to the picture content.
[0050] Further, in an example, the client can use the GraphQL query language to request the server to perform file content change at the field level. The GraphQL query language supports obtaining data of multiple fields in one request, including text fields, picture fields, and so on.
[0051] In some embodiments of the present disclosure, in a multi-user collaborative editing scenario, the client needs to request the server to generate dynamic content. Using the GraphQL query language, a request can be sent through the query function of GraphQL to obtain the required content from the server. That is to say, the change request of the target content sent by the first client to the server may include a query request for the target content. On this basis, combined with the solution of the content change method M10 in the present disclosure for data transmission based on the target field with the minimum response, when the first client needs to obtain the target content, the server only needs to return the target field for generating the target content, and the first client can use the target field to generate the target content. That is to say, in the case where the change request of the target content is a query request for the target content, the target field for changing the target content may include the target field for obtaining the target content. For example, when the first client requests the server to query a certain picture, the server only needs to return the url field of the picture, and the first client can use the url field to obtain the picture to be queried.
[0052] In this case, when the content change request of the first client is a query request for the target content, the server does not extract the target field from the query request, but responds to the query request to generate the target field for obtaining the target content.
[0053] Specifically, regarding step S11, in some embodiments of the present disclosure, it may include steps S111 to S113 as Figure 5 shown.
[0054] S111. The server parses the query request and identifies the type of the target content requested by the first client.
[0055] In one embodiment, the server uses the Resolver of GraphQL to parse the query request of the first client to obtain the type of the target content. The type of the target content is used to restrict the fields and structures that the first client can request, preventing the first client from making unauthorized queries. For example, if the first client requests to query a certain picture A, then picture A is the target content, and picture is the type of the target content.
[0056] S113. The server generates target fields for obtaining the target content based on the type of the target content. In one embodiment, the server uses the Schema function of GraphQL to perform legality verification to determine the field types corresponding to the type of the target content. For example, when the type of the target content is an article (Post), the corresponding field types may include id, title, content, author, etc., providing a basis for generating the target fields. On the basis of determining the field types corresponding to the type of the target content, the server uses the Resolver to generate target fields of the corresponding type, where the parameters of the target fields can be obtained by the Resolver parsing the query request of the first client. For example, the cover field is the field type corresponding to the target content of the picture type and is a nested structure field. For example, "cover{url}" indicates that the content of the cover field is the url. The Resolver determines the picture corresponding to the target content by parsing the query request of the first client, reads the original path of the picture from the database based on the reading rules of the picture data, and splices dynamic parameters to generate the url of the target picture. Assuming the url of the target picture is "https: / / xx.com / cover.jpg?w=800", combining with the type of the picture field, the structured target field is obtained: "cover{https: / / xx.com / cover.jpg?w=800}".
[0057] In some embodiments of the present disclosure, the content change method M10 may further include step S14 as Figure 6 shown. S14. The server returns the target fields and the version number of the latest version to the first client. The version number of the latest version is used for the first client to update the version of the target file. When the first client determines that the current version number of the target file on the first client is behind the version number of the latest version returned by the server, the first client updates the local target file to the latest version based on the target fields.
[0058] In one embodiment, the change request for the target content sent by the first client to the server includes a query request for the target content. In this scenario, the server returns the target fields for obtaining the target content, enabling the first client to obtain the target content based on the target fields. Furthermore, the latest version of the target file on the server can be obtained by performing a change operation on the target content based on the target fields. Based on this, the first client can also perform a change operation on the target content in the same way based on the target fields to obtain the latest version of the target file. During this process, the server does not need to return the complete data of the target content. Only returning the target fields for obtaining the target content can meet the needs of the first client to change the target content, reducing the amount of data transmitted and the burden of data transmission.
[0059] In another embodiment, the change request for the target content sent by the first client to the server includes the complete data of the target content. In this scenario, the server returns the target fields for changing the target content, and the first client can then change the target content of the target file on the first client's local side based on the target fields, fulfilling the target change requirements of the first client. During this process, the first client only needs to provide the changed target content to the server. The first client does not need to extract the target fields of the minimized data response for changing the target content, which are extracted by the server, reducing the workload of the first client.
[0060] In yet another embodiment, the change request for the target content sent by the first client to the server includes the target fields for obtaining the target content. In this scenario, although the first client already has the target fields locally, after the server updates the version of the target file, it returns the incremental target fields to the first client for updating the version of the target file on the first client, which can ensure that the target content changed by the first client and the server is the same content, ensuring the consistency of data synchronization and update.
[0061] Regarding step S13, in some embodiments of the present disclosure, it may include steps S131 to S136 as Figure 7 shown.
[0062] S131. The server parses the change request to obtain the first - end version number of the target file of the first client. Among them, the first - end version number is the version number of the current version of the target file for which the first client currently requests to change the target content.
[0063] S132. The server determines an intermediate version number based on the version difference between the server version number corresponding to the target cached data and the first - end version number, and obtains the field change log of the intermediate version number. Among them, the server version number corresponding to the target cached data is the version number corresponding to the target field that caused the target cached data to change when the target cached data was last changed on the server. For example, when the server caches the target field of version V5.0.1 to update the target cached data, the server version number corresponding to the updated target cached data is V5.0.1.
[0064] The intermediate version number includes one or more version numbers with mismatched prefixes between the server version number and the first - end version number. For example, the version number V5.0.1 and the version number V5.3.2 have a matching prefix; the version number V5.0.1 and the version number V2.0.1 have a mismatched prefix. Assume that the server version number is V2.0.1 and the first - end version number is V5.0.1, then the intermediate version number should include version numbers with prefixes: "V3" and "V4".
[0065] Further, in one embodiment, when obtaining the intermediate version number, only the version number of the latest effective version with each different version - number prefix is obtained. For example, assume that the version numbers with prefix "V3" include "V3.0.1" and "V3.1.0", and "V3.1.0" is the version number of the latest effective version among the version numbers with prefix "V3", then when obtaining the intermediate version number, only "V3.1.0" needs to be obtained.
[0066] The field change log is data persistently stored in the database of the server. Each field change date corresponds to a version of the target file and is used to record information such as the type of the target content that needs to be changed for the target file changed to this version, the location or range of the target file affected by the change operation, and the specific target field of the change. Based on the field change log, the server can reproduce the change operations of the target content of the corresponding - version target file.
[0067] S133. The server loads the target cache data to obtain the target file corresponding to the server version number. The target file corresponding to the server version number is used as the base file for obtaining the target file of the first - end version, so as to update the target file corresponding to the server version number to obtain the target file of the first - end version in subsequent steps. Since the target cache data is the data cached on the server, it has a relatively fast loading speed, which can improve the data synchronization efficiency. Since the content included in the target cache data is the content with a change frequency lower than the preset change - frequency threshold, it rarely changes during version updates. When updating the version of the target file corresponding to the server version number obtained by loading the target cache data, the degree of change of the content obtained by loading the target cache data is small, and the retention rate of these contents in the finally obtained target file of the first - end version is large. If the content in the target cache data that still remains in the target file of the first - end version is recorded as valid cache content, then the proportion of valid cache content in the target cache data is large. It can be determined that the caching policy of the server caching content with a change frequency lower than the preset change - frequency threshold can improve the cache utilization rate of the server.
[0068] S134. The server performs a field - change operation on the target file corresponding to the server version number based on the field - change log of the intermediate version number to obtain the target file of the first - end version.
[0069] Based on the fact that the target cache data is data that does not change frequently, the content in the target file corresponding to the server version number rarely changes during version updates. Based on this, when the server performs a field - change operation on the target file corresponding to the server version number based on the field - change log of the intermediate version number, most of the operations are adding the content corresponding to the fields in the field - change log of the intermediate version number to the target file, and less involves modifying the content in the target cache data. That is, there are fewer cases where the content obtained by loading the target cache data is modified again, thus reducing duplicate calculations.
[0070] In one embodiment, if the version prefixes between the server version number corresponding to the target cache data and the first - end version number differ by 1 or 0. For example, the server version number and the first - end version number are "V3.0.1" and "V3.1.0" respectively; or they are "V3.0.1" and "V4.1.0" respectively. Then, when updating the target file with the server version number to the target file with the first - end version number, it is not necessary to use the target file with the intermediate version number as a transition version. When obtaining the target file with the first - end version number based on the target file with the server version number, that is to say, in this case, steps S132 and S134 can be skipped. Based on the target file corresponding to the server version number obtained in step S133, the content in the target file corresponding to the server version number is changed by using the field change log corresponding to the first - end version, so as to obtain the target file with the first - end version.
[0071] S135. The server changes the target content of the target file with the first - end version based on the target field to obtain the changed target file.
[0072] When the server obtains the target file with the first - end version, the version of the target file on the server is consistent with the version of the target file affected by the content change request submitted by the first client. Based on this, the content of the target file with the first - end version can be changed on the server based on the target field. The target file obtained by changing the content of the target file with the first - end version based on the target field is recorded as the changed target file.
[0073] S136. The server increments the version number of the first - end version number as the version number of the changed target file to obtain the target file with the latest version.
[0074] When the server generates the changed target file, before the server performs a new content synchronization task, the content of the changed target file is the content of the current latest version of the target file. Based on this, by assigning the latest version number to the changed target file, the target file with the latest version can be obtained. At this time, the latest version number can be obtained by incrementing the version number of the first - end version number, and the increment rule of the version number is not limited here.
[0075] In some embodiments of the present disclosure, the content change method M10 may further include steps S18 to S19 as Figure 8 shown.
[0076] S18. The server determines the fields in the target file with the latest version that have changed relative to the target file of the second client subscribing to the server as the changed fields.
[0077] In one embodiment, the server pushes the latest version of the target file to the client with a subscription relationship based on a subscription mechanism. In a multi-user collaborative editing scenario, the client that actively initiates a request to the server for content synchronization and update of the target file is denoted as the first client in this content synchronization task; the client that receives the latest version of the target file pushed by the server is denoted as the second client in this content synchronization task.
[0078] Combined with the change strategy of the target content in the foregoing, when it is necessary to change the target content, only the change operation on the minimized response field of the target content change is required to achieve the change of the target content. Based on this, when synchronizing the content of the latest version of the target file to the second client, the second client can also change the content in the target file through the change operation at the field granularity. Therefore, the client only needs to transmit the data at the field granularity to meet the content synchronization requirements of the second client, which can ensure the accuracy of the synchronized data and reduce the network transmission burden.
[0079] Among them, the content difference between the target file of the second client and the latest version of the target file on the server is not necessarily limited to the difference in the target content requested by the first client to change between the server and the target file of the second client. It is necessary to combine the content difference between the target file of the second client and the latest version of the target file on the server to determine all the content that needs to be changed when updating the version of the target file of the second client. Further, on the basis that the second client supports content change at the field granularity, the server can compare the difference at the field granularity between the latest version of the target file and the target file of the second client, and determine the changed fields in the server relative to the target file of the second client as the change fields. The second client can update the local target file to the same version as the latest version of the target file on the server by performing a change operation on the local target file based on the change fields. In this way, in the process of pushing the content of the new version to the second client, the server does not need to transmit the complete data of the content that the second client needs to change, and only needs to transmit the data for synchronizing the content of the target file of the second client to the latest version. It can reduce the network transmission burden during the synchronization process.
[0080] S19. The server pushes the change fields to the second client. Among them, the change fields are used to synchronize the content of the target file of the second client to the latest version, so that the second client can synchronize the content of the target file to the latest version through the content change operation at the field granularity.
[0081] Regarding step S18, in some embodiments of the present disclosure, it may include steps S181 to S184 as Figure 9 shown.
[0082] S181. The server obtains the latest version number of the target file of the second client, obtaining the latest version number of the second client. In one embodiment, the server periodically sends an acquisition request for obtaining the version number of the target file to the second client, and the second client uploads the latest version number of the target file on the local side of the second client in response to the acquisition request. Thus, since the acquisition of the latest version number of the second client is periodic, it can be ensured that the frequency of two updates of the second client is at least separated by one period, avoiding that when the latest version number on the server changes multiple times in a short period, the latest version number does not match the latest version number of the second client multiple times, resulting in too frequent updates of the target file on the second client.
[0083] In yet another embodiment, the second client periodically sends the latest version number of the second client to the server. Thus, when the second client does not need to update the version of the target file, it can operate on the second client to refuse to send the latest version number of the second client to the server, enabling the second client to have the right to actively update.
[0084] In another embodiment, when the server generates the target file of the latest version, the server sends an acquisition request for obtaining the version number of the target file to each second client with a subscription relationship. Thus, it can be ensured that the target file of the latest version is pushed to the second client in a timely manner.
[0085] S182. When the latest version number of the second client lags behind the version number of the latest version, the server queries the target file corresponding to the latest version number of the second client, obtaining the target file of the second client version.
[0086] In one embodiment, in the scenario of multi-user collaborative editing, the server always generates the target file of the latest version, and then synchronizes the version numbers of the target files of each client. Based on this, the version numbers of the target files stored on the server include the version numbers of the target files of each client.
[0087] In one embodiment, each version of the target file is persistently stored in the database of the server. When it is necessary to obtain the target file of the second client version, the server queries the target file corresponding to the latest version number of the second client in the database, obtaining the target file of the second client version.
[0088] S183. The server compares the content differences between the target file of the latest version and the target file of the second client version, obtaining the content of the server and the content of the second client with differences. Among them, the content differences include new content, deleted content, and modified content. Assume that in the target file of the latest version Figure 1 and the Figure 1 of the second client version are different pictures, then it is determined that Figure 1 has content differences, and the Figure 1content and that of the second client Figure 1 content
[0089] S184. The server compares the field differences between the server content with differences and the content of the second client, and determines the changed fields in which the server content with differences has changed relative to the content of the second client.
[0090] Assume that the Figure 1 of the server can be obtained by acquiring the picture at address A, and the Figure 1 of the second client can be obtained by acquiring the picture at address B. Then address A is the Figure 1 of the server with differences relative to the Figure 1 changed fields. Based on this, address A can be used to synchronize the Figure 1 content of the second client to be consistent with the Figure 1 content of the server.
[0091] Based on any of the above embodiments, the present disclosure further provides a content change device, which can be configured in the server in the embodiments of the present disclosure. Figure 10 It is a structural schematic diagram of the content change device of an embodiment of the present disclosure. As Figure 10 shown, the content change device includes: a request response module 110, a file generation module 120, a change frequency acquisition module 130, and a cache module 140.
[0092] The request response module 110 is configured to respond to a change request of the target content of the target file by the first client, and acquire the target field used to change the target content in the change request. The file generation module 120 is configured to generate the latest version of the target file based on the target cache data corresponding to the target file in the server and the target field. The change frequency acquisition module 130 is configured to acquire the change frequency of the target content. The cache module 140 is configured to update the target cache data based on the target field when the change frequency is lower than a preset change frequency threshold.
[0093] The above content change device may be computer software, and each of its modules may be a computer software module. The implementation processes of the functions and roles of each module in the above content change device are specifically detailed in the implementation processes of the corresponding steps in the above method, and will not be elaborated here.
[0094] Based on any of the above embodiments, the present disclosure further provides an electronic device, which can execute the content change method of any of the above embodiments described in the present disclosure.
[0095] Figure 11 It is a structural schematic diagram of an electronic device 1000 of an embodiment of the present disclosure.
[0096] The hardware structure of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnected buses and bridges, depending on the specific application of the hardware and the overall design constraints. The bus 1100 connects various circuits including one or more processors 1200, a memory 1300, and / or hardware modules together. The bus 1100 can also connect various other circuits 1400 such as peripheral devices, voltage regulators, power management circuits, external antennas, etc.
[0097] The bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity in representation, only one connecting line is shown in this figure, but it does not mean that there is only one bus or one type of bus.
[0098] The present disclosure also provides a readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the above-mentioned method. The "readable storage medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples of the readable storage medium include the following: an electrical connection part (electronic device) having one or more wirings, a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0099] The present disclosure also provides a computer program product. The method of the present disclosure can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, the processes or functions of the present disclosure are executed in whole or in part.
[0100] Computer programs or instructions can be stored in a readable storage medium or transmitted from one readable storage medium to another. For example, computer programs or instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired or wireless manner. The readable storage medium can be any available medium that can be accessed or a data storage device such as a server or data center integrating one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc; or it can be a semiconductor medium, such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or can include both volatile and non-volatile types of storage media.
[0101] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, system, or computer program product. Therefore, the present disclosure can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0102] The present disclosure is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable content synchronization devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable content synchronization devices generate means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.
[0103] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable content synchronization device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.
[0104] These computer program instructions can also be loaded onto a computer or other programmable content synchronization device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide for implementing the process Figure 1 in one process or multiple processes and / or blocks Figure 1 steps for the functions specified in one block or multiple blocks.
[0105] In the description of this specification, the description with reference to terms such as "one embodiment / way", "some embodiments / ways", "example", "specific example", or "some examples" means that the specific features, structures, or characteristics described in connection with the embodiment / way or example are included in at least one embodiment / way or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / way or example. Moreover, the specific features, structures, or characteristics described can be combined in a suitable manner in any one or more embodiments / ways or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments / ways or examples described in this specification and the features of different embodiments / ways or examples.
[0106] Those skilled in the art should understand that the above embodiments are only for clearly illustrating the present disclosure, rather than limiting the scope of the present disclosure. For those skilled in the art, other changes or variations can be made on the basis of the above disclosure, and these changes or variations are still within the scope of the present disclosure.
Claims
1. A content change method, characterized in that Including: The server, in response to a change request from a first client for the target content of a target file, obtains the target field in the change request for changing the target content; The server generates the latest version of the target file based on the target cache data corresponding to the target file on the server and the target field; The server obtains the change frequency of the target content; And When the change frequency is lower than a preset change frequency threshold, the server caches the target field in the target cache data to obtain the updated target cache data.
2. The content change method according to claim 1, characterized in that, Also including: The server determines the changed fields in the latest version of the target file that have changed relative to the target file of a second client subscribing to the server; And The server pushes the changed fields to the second client, and the changed fields are used to synchronize the content of the target file of the second client to the latest version.
3. The content change method according to claim 2, characterized in that, The server determines the changed fields in the latest version of the target file that have changed relative to the target file of the second client, including: The server obtains the latest version number of the target file of the second client to get the latest version number of the second end; When the latest version number of the second end lags behind the version number of the latest version, the server queries the target file corresponding to the latest version number of the second end to obtain the target file of the second end version; The server compares the content differences between the latest version of the target file and the target file of the second end version to obtain the different server content and second client content; and The server compares the field differences between the different server content and the second client content to determine the changed fields in the different server content that have changed relative to the second client content.
4. The content change method according to claim 1, characterized in that, The change request for the target content includes a query request for the target content; the target field for changing the target content includes the target field for obtaining the target content; Obtaining the target field in the change request for changing the target content includes: The server parses the query request to identify the type of the target content requested by the first client to query; And The server generates the target field for obtaining the target content based on the type of the target content.
5. The content change method according to claim 4, characterized in that Also including: The server returns the target field and the version number of the latest version to the first client.
6. The content change method according to claim 1, characterized in that, The server generates the latest version of the target file based on the target cache data corresponding to the target file on the server and the target field, including: The server parses the change request to obtain the first end version number of the target file of the first client; The server determines the intermediate version number based on the version difference between the server version number corresponding to the target cache data and the first end version number, and obtains the field change log of the intermediate version number; The server loads the target cache data to obtain the target file corresponding to the server version number; The server performs a field change operation on the target file corresponding to the server version number based on the field change log of the intermediate version number, and obtains the target file of the first-end version; The server changes the target content of the target file of the first-end version based on the target field, and obtains the changed target file; and The server performs an increment processing on the first-end version number as the version number of the changed target file, and obtains the target file of the latest version.
7. The content change method according to claim 1, characterized in that It further includes: When the change frequency is higher than or equal to a preset change frequency threshold, the server generates a field change log corresponding to the version number of the latest version based on the target field.
8. An electronic device, characterized in that, It includes: A memory, which stores execution instructions; And A processor, which executes the execution instructions stored in the memory, so that the processor executes the content change method described in any one of claims 1 to 7.
9. A readable storage medium, characterized in that, Execution instructions are stored in the readable storage medium, and when the execution instructions are executed by the processor, they are used to implement the content change method described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the content change method described in any one of claims 1 to 7.
Citation Information
Patent Citations
File synchronization method and device, electronic equipment and storage medium
CN116506450A
Systems and methods for caching and serving dynamic content
US20080320225A1
System and method for optimizing transmission of requests for updated content from external data sources
US20210191918A1
Data synchronization method and server
US20250141958A1
Caching of updated network content portions
US9953052B1