Content changing method, electronic device, storage medium and program product

The target fields that minimize response and change frequency threshold management are obtained by the server, the synchronization process of multi-user collaborative editing is optimized, network bandwidth waste and delay problems in the existing technology are solved, and efficient content synchronization and cache management are achieved.

CN120371848BActive Publication Date: 2025-08-26ZHEJIANG PLANER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510880892.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-08-26
Estimated Expiration
2045-06-27

AI Technical Summary

Technical Problem

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.

Method used

The server responds to the client's change request, obtains the target field that minimizes the response, generates the latest version of the target file, and decides whether to cache data based on the change frequency threshold, and uses the target cache data and field change log to optimize the synchronization process to reduce invalid cache and repeated calculations.

Benefits of technology

It improves the data transmission efficiency of multi-user collaborative editing, reduces network bandwidth waste and interaction delay, and ensures the accuracy and consistency of content synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371848B_ABST
    Figure CN120371848B_ABST
Patent Text Reader

Abstract

The present disclosure provides a content change method, electronic device, readable storage medium, and computer program product. The content change method of the present disclosure includes: a server responding to a first client's request to change the target content of a target file, obtaining a target field in the change request for changing the target content; the server generating the latest version of the target file based on the target cache data and target field corresponding to the target file on the server; the server obtaining the change frequency of the target content; and when the change frequency is lower than a preset change frequency threshold, the server caching the target field in the target cache data to obtain the updated target cache data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a content changing method, electronic device, storage medium, and program product. Background Art

[0002] In modern web application development, efficient data interaction and real-time content synchronization are core challenges in building complex collaborative tools, such as rich text editors, online documents, and PowerPoint collaborative editing systems. Traditional solutions rely on rigid server-side caching strategies, which can lead to invalid data being cached. This model can waste network bandwidth and cause interaction delays in scenarios with frequent content updates, severely impacting the real-time collaborative experience for multiple users. Summary of the Invention

[0003] The present disclosure provides a content changing method, an electronic device, a storage medium, and a program product.

[0004] According to one aspect of the present disclosure, a content change method is provided, comprising: a server side responding to a change request for a target content of a target file from a first client side, obtaining a target field in the change request for changing the target content; the server side generating a latest version of the target file based on target cache data corresponding to the target file on the server side and the target field; the server side obtaining a change frequency of the target content; and when the change frequency is lower than a preset change frequency threshold, the server side caching the target field in the target cache data to obtain the updated target cache data.

[0005] According to at least one embodiment of the content change method of the present disclosure, the method further includes: the server determines the field in the target file of the latest version that has changed relative to the target file of the second client subscribed to the server as a changed field; 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 at least one embodiment of the content change method 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, and obtains 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, and obtains the second end version of the target file; the server compares the content difference between the target file of the latest version and the target file of the second end version, and obtains the server content and the second client content with the difference; the server compares the field difference between the server content with the second client content with the difference, and determines the changed fields of the server content with the difference 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 field used to change the target content includes a 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 and identifies the type of the target content requested by the first client; the server generates a target field for obtaining the target content based on the type of the target content.

[0008] According to at least one embodiment of the present disclosure, the content change method further includes: the server returning the target field and the version number of the latest version to the first client.

[0009] According to at least one embodiment of the content change method disclosed herein, the server generates the latest version of the target file based on the target cache data and the target field corresponding to the target file on the server, 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 first-end version of the target file; the server changes the target content of the first-end version of the target file based on the target field to obtain the changed target file; the server increments the first-end version number as the version number of the changed target file to obtain the latest version of the target file.

[0010] According to at least one embodiment of the present disclosure, the content change method 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, an electronic device is provided, including: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, so that the processor executes the content changing method of any embodiment of the present disclosure.

[0012] According to another aspect of the present disclosure, a readable storage medium is provided, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the content changing method of any embodiment of the present disclosure.

[0013] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the content changing method of any embodiment of the present disclosure when the computer program is executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.

[0015] Figure 1 It is a flowchart of a content changing method according to an embodiment of the present disclosure.

[0016] Figure 2 It is an application diagram of a content changing method according to an embodiment of the present disclosure.

[0017] Figure 3 It is an application diagram of a content changing method according to an embodiment of the present disclosure.

[0018] Figure 4 It is a flowchart of a content changing method according to an embodiment of the present disclosure.

[0019] Figure 5 It is a partial flowchart of a content changing method according to an embodiment of the present disclosure.

[0020] Figure 6 It is a flowchart of a content changing method according to an embodiment of the present disclosure.

[0021] Figure 7 It is a partial flowchart of a content changing method according to an embodiment of the present disclosure.

[0022] Figure 8It is a flowchart of a content changing method according to an embodiment of the present disclosure.

[0023] Figure 9 It is a partial flowchart of a content changing method according to an embodiment of the present disclosure.

[0024] Figure 10 It is a schematic block diagram of the structure of a content changing device according to one embodiment of the present disclosure.

[0025] Figure 11 It is a schematic block diagram of the structure of an electronic device according to one embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] The present disclosure is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are intended only to illustrate the relevant content and are not intended to limit the present disclosure. It should also be noted that, for ease of description, only the portions relevant to the present disclosure are shown in the accompanying drawings.

[0027] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0028] In multi-user collaborative editing scenarios, existing technical solutions generally face a conflict between varying content update frequencies and a unified caching mechanism. This results in wasted network bandwidth and interaction delays when supporting large-scale real-time collaboration, leading to cascading technical obstacles such as increased synchronization latency, client-side rendering jitter, and server-side resource overload.

[0029] The embodiments of the present disclosure provide a content modification method that can be executed by a computer device. The content modification method of the embodiments of the present disclosure is mainly used to reduce the synchronous transmission burden of multi-user collaborative editing scenarios.

[0030] Figure 1 FIG. 1 shows a schematic diagram of the overall process of a content change method M10 according to an embodiment of the present disclosure. Figure 1 The method shown includes steps S11 to S17.

[0031] S11. The server responds to a request from the first client to change target content of a target file, and obtains a target field in the change request for changing the target content.

[0032] See also 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 ,changed content by the client to obtain the new version of the ,target file, and synchronizing the changed content to other ,clients as required.

[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 client A's change request, client A is considered the first client for this synchronization task. Similarly, if client B sends a change request to the server during the next synchronization task, client B is considered the first client for the next synchronization task.

[0034] The target file is a 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., without limitation.

[0035] The target content refers to the content in the target file that has been changed due to the operation of the first client. Among them, the way of changing includes generating new content, deleting existing content, and modifying existing content. Accordingly, the change request may include a request to generate content, delete content, and modify content. The type of target content may include text, pictures, charts, animations, etc. For example, assuming that the first client modifies the title of the PPT file and replaces Picture 2, and sends the change request corresponding to the above change operation to the server, then the PPT file is the target file, and the title text and Picture 2 of the PPT file are the target content.

[0036] The target field is the precise field that minimizes the response required to change the target content. For example, text content typically includes fields such as title, text, author, and timestamp. If the first client's change operation on the target file's text content only involves a change to the title, then when the server synchronizes the first client's change operation on the target file's text content, it only needs to change the title field to meet the functional requirements. In this case, fields such as text, author, and timestamp are redundant fields in this change operation. Therefore, the field that minimizes the response required to meet the target content change requirements is used as the target field in this synchronization change operation, and is distinguished from redundant fields.

[0037] In one embodiment, the server can extract the target field from the redundant data of the first client's request to change the target content of the target file. For example, the first client's request to change the target content of the target file includes all the data of the target content after the change and the version information of the target file of the first client. Based on this, the server determines the target content before the change based on the current version of the target file of the first client, and extracts the target field required to change 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 field in the change request. In this way, the server can accurately use the target field to synchronize the 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 precisely upload target fields for synchronization of target content changes. For example, the first client's request to change the target content of a target file includes a change operation log and the version information of the first client's target file. The change operation log includes the type of target content to be changed, the location or range of the target file affected by the change operation, and the specific target fields to be changed. This can further reduce the amount of data transmitted between the first client and the server, reduce network transmission burden, and improve synchronization efficiency.

[0039] S13. The server generates the latest version of the target file based on the target cache data and target fields corresponding to the target file on the server. In a multi-user collaborative editing scenario, multiple clients and servers collaborate to process target files that are usually files with the same name. If the versions of the target files on different ends are exactly the same, the contents of the target files on different ends are also exactly the same; otherwise, if the versions of the target files on the two ends are not exactly the same, the contents of the target files on the two ends are not necessarily the same. In the case where the first client sends a request to change the target content of the target file to the server, the server generates the latest version of the target file locally on the server based on the target field in the change request, and then synchronizes the latest version of the target file to the first client. In this process, it is necessary to generate the latest version of the target file on the server for disseminating the latest version of the target file to other clients.

[0040] To quickly generate the target file, the server caches a portion of the target file's data as the target cache data on the server. This way, when the server needs to generate the latest version of the target file, it can return the target cache data from memory to generate the latest version of the target file, eliminating the need to query the database for this data, improving data transmission efficiency.

[0041] Please combine Figure 3In one embodiment, the target cache data cached by the server is the content in the target file that does not change often. When the server updates the version of the target file based on the target field, the server loads part of the content of the target file based on the target cache data; then, based on the content difference between the first client's version and the target cache data, the server obtains data from the database for supplementing the content of the target cache data to the first client's version, so that the server loads the first client's version of the target file; finally, based on the first client's version of the target file, the target field is changed to obtain the latest version of the target file. For example, Figure 3 In the illustrated example, the target field change operation involves changing field A in the first client's version of the target file to field B. During the generation of the latest version of the target file, the infrequently changing content in the latest version of the target file is loaded based on the target cache data. The target field is retrieved from the first client's change request. Only the data missing from the target cache relative to the first client's version of the target file needs to be retrieved through database queries. This data constitutes a relatively small portion of the latest version of the target file. This reduces the transmission burden and improves data transmission efficiency.

[0042] S15. The server obtains the frequency of target content changes. The frequency of target content changes is used to determine whether the target content is data that does not change frequently. In one embodiment, the frequency of target content changes can be obtained by counting the frequency of client requests to change the target content, the frequency of target content changes on the server, and other data. For example, the average frequency of each client requesting to change the target content in a collaborative editing scenario can be used as the frequency of target content changes, the frequency of target content changes on the server can be used as the frequency of target content changes, and so on. There is no limitation 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 change frequency of the target content to determine whether the target content is data that does not change frequently. Figure 3When the version is updated, the server first loads a portion of the files based on the target cache data that does not change frequently. Since data that does not change frequently is often difficult to conflict with the same content data of other versions, when the partial files loaded based on the target cache data are updated to the latest version of the target file, the amount of change 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 data that does not change frequently and cached so that it can be quickly loaded during the next synchronization task. On the contrary, if the data that changes frequently is cached, then when the partial files loaded based on the data that changes frequently are updated to the latest version of the target file, the amount of change 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, avoiding unnecessary repeated calculations caused by changing the data that changes frequently again during the process of updating the latest version.

[0044] When the target content is determined to be data that does not change frequently, the cache of the target content is still cached based on the target field of the minimized response, and the current target cache data of the server is updated based on the target field to obtain the updated cache data. Specifically, if there is no field with the same name as the target field in the target cache data, then a new 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, then 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, then the field with the same name in the target cache data is deleted.

[0045] In summary, the content change method of the embodiment of the present disclosure, when a server synchronizes a change operation with a client, changes the target content of a target file based on the server's target cache data and the target field required for the minimum response of the change operation, generating the latest version of the target file with the changed target content. The target cache data is used to quickly load a portion of the target file's infrequently updated content when generating the latest version of the target file. This infrequently updated content experiences fewer data changes during the generation of the latest version of the target file, thereby reducing repeated calculations of data changes. Frequently changing data is not cached because, even if cached, it is likely to change during the generation of the latest version of the target file, resulting in the cached data not being applied to the latest version of the target file, causing invalid caching. Furthermore, when the server responds to a first client's request to change the target content and updates the target file version based on the target field, a preset change frequency threshold is used to determine whether the target content is infrequently changing data. If the target content's change frequency is lower than the preset change frequency threshold, it is determined to be infrequently changing data and cached to update the server's current target cache data. This ensures data transmission efficiency while avoiding invalid caching of data and reducing the burden of repeated calculations and transmissions.

[0046] In some embodiments of the present disclosure, the content change method M10 may further include: Figure 4 Step S16 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 field.

[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 frequently changing data. For frequently changing data, even if it is cached so that it can be loaded quickly, it is easy to change after loading, and ultimately it is difficult to retain it in the latest version of the target file. This is equivalent to caching data that is not used in the latest version of the target file, resulting in invalid cache. Based on this, for frequently changing target content, its corresponding target field is generated as a field change log, and the field change log is persistently stored in the server's database. When it is necessary to use the field change log to update the version of the target file, the server queries the database to obtain the field change log corresponding to the required version number. In this way, invalid cache can be avoided and cache space occupancy can be reduced.

[0048] The field change log is used to record information such as the type of target content that needs to be changed, the location or range of the target file affected by the change, and the specific target fields that are changed. When the field change log corresponds to the version number of the latest version, when the target file representing the version previous to the latest version is updated to the latest version, the field-level file content can be changed based on the field change log corresponding to the latest version number to update the target file from the version previous to the latest version to the latest version.

[0049] In some embodiments of the present disclosure, a first client's request to change the target content of a target file may include requesting changes to multiple different types of target content. For example, a single change request may request changes to both text content and image content. Accordingly, the server uses the target fields corresponding to the text content and the target fields corresponding to the image content to synchronize the content changes.

[0050] Furthermore, in one example, the client can use the GraphQL query language to request the server to modify the file content at the field level. The GraphQL query language supports obtaining data for multiple fields in a single request, including text fields, image 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 issued through the query function of GraphQL to obtain the required content from the server. In other words, the target content change request sent by the first client to the server may include a query request for the target content. On this basis, combined with the content change method M10 of the present disclosure that performs data transmission based on the target field of the minimized 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. In other words, in the case where the target content change request is a query request for the target content, the target field used to change the target content may include a 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 target content, the server does not extract the target field from the query request, but generates a target field for obtaining the target content in response to the query request.

[0053] Specifically, regarding step S11, in some embodiments of the present disclosure, it may include the following: Figure 5 Steps S111 to S113 are shown.

[0054] S111 : The server parses the query request and identifies the type of target content requested by the first client.

[0055] In one embodiment, the server uses the GraphQL resolver to parse the first client's query request and obtain the target content type. The target content type is used to constrain the fields and structure that the first client can request, preventing the first client from making unauthorized queries. For example, if the first client requests a query for a specific image, image A is the target content, and image is the type of the target content.

[0056] S113. The server generates a target field for retrieving the target content based on the target content type. In one embodiment, the server utilizes GraphQL's Schema functionality to perform a validity check and determine the field types corresponding to the target content type. For example, if the target content type is a post, the corresponding field types may include id, title, content, author, etc., providing a basis for generating the target field. Based on the field types corresponding to the target content type, the server utilizes a resolver to generate a target field of the corresponding type. The parameters of the target field can be obtained by parsing the first client's query request with the resolver. For example, the cover field corresponds to the target content type of image and is a nested field. For example, "cover{url}" indicates that the cover field's content is a URL. The resolver parses the first client's query request to determine the image corresponding to the target content. Based on the image data reading rules, it retrieves the image's original path from the database and concatenates the dynamic parameters to generate the target image's URL. For example, if the target image's URL is "https: / / xx.com / cover.jpg?w=800", combined with the image field type, the structured target field is: "cover{https: / / xx.com / cover.jpg?w=800}".

[0057] In some embodiments of the present disclosure, the content change method M10 may further include: Figure 6 Step S14 is shown. S14: The server returns the target field and the latest version number to the first client. The latest version number is used by the first client to update the target file. When the first client determines that the current version number of the target file locally on the first client lags behind the latest version number returned by the server, the first client updates the local target file to the latest version based on the target field.

[0058] In one embodiment, the target content change request sent by the first client to the server includes a query request for the target content. In this scenario, the server returns the target field for obtaining the target content, so that the first client can obtain the target content based on the target field. 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 field. Based on this, the first client can use the same method to perform a change operation on the target content based on the target field to obtain the latest version of the target file. In this process, the server does not need to return the complete data of the target content, but only needs to return the target field for obtaining the target content to meet the first client's need to change the target content, which can reduce the amount of data transmitted and reduce the burden of data transmission.

[0059] In another embodiment, the target content change request sent by the first client to the server includes the complete data of the target content. In this scenario, the server returns the target field for changing the target content. The first client can then change the target content of the target file locally on the first client based on the target field, thus fulfilling the first client's target change request. 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 field of the minimized data response used to change the target content. The target field is extracted by the server, reducing the workload of the first client.

[0060] In another embodiment, the target content change request sent by the first client to the server includes a target field for obtaining the target content. In this scenario, although the first client already has the target field locally, after the server updates the target file version, it returns the incremental target field to the first client for the first client's target file version update. This ensures that the target content changed by the first client and the server is the same, ensuring consistency in data synchronization updates.

[0061] Regarding step S13, in some embodiments of the present disclosure, it may include the following Figure 7 Steps S131 to S136 are shown.

[0062] S131: The server parses the change request to obtain a first-end version number of the target file of the first client, wherein the first-end version number is the version number of the current version of the target file whose target content is currently being changed by the first client.

[0063] S132. The server determines an intermediate version number based on the difference between the server version number corresponding to the target cache data and the first-end version number, and obtains a field change log for the intermediate version number. The server version number corresponding to the target cache data is the version number corresponding to the target field that caused the target cache data to be changed when the target cache data was most recently changed on the server. For example, if the server caches version V5.0.1 of the target field to update the target cache data, the server version number corresponding to the updated target cache data is V5.0.1.

[0064] Intermediate version numbers include one or more version numbers whose prefixes do not match between the server version number and the first-end version number. For example, version number V5.0.1 matches the prefix of version number V5.3.2; version number V5.0.1 does not match the prefix of version number V2.0.1. Assuming the server version number is V2.0.1 and the first-end version number is V5.0.1, the intermediate version numbers should include version numbers with the prefixes "V3" and "V4".

[0065] Furthermore, in one embodiment, when obtaining intermediate version numbers, only the version number of the latest effective version for each different version number prefix is ​​obtained. For example, assuming that the version numbers prefixed with "V3" include "V3.0.1" and "V3.1.0", where "V3.1.0" is the latest effective version among the version numbers prefixed with "V3", then when obtaining the intermediate version number, "V3.1.0" is sufficient.

[0066] Field change logs are data persistently stored in the server's database. Each field change date corresponds to a target file version. They record information such as the type of target content that needs to be changed to that target file version, the location or range of the target file affected by the change, and the specific target fields that were changed. Based on the field change logs, the server can replicate target content changes for the corresponding target file version.

[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 that the target file corresponding to the server version number can be updated in subsequent steps to obtain the target file of the first-end version. Since the target cache data is data cached on the server, it has a faster loading speed and can improve data synchronization efficiency. Since the content contained in the target cache data is content with a change frequency lower than the preset change frequency threshold, it rarely changes during version updates. When the target file corresponding to the server version number obtained by loading the target cache data is updated, the degree of change of the content obtained by loading the target cache data is relatively small, and the retention rate of this content in the target file of the first-end version is relatively high. If the content of the target cache data still retained 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 relatively large, and it can be determined that the cache strategy with a server cache 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] Since the target cache data is infrequently changing, the content in the target file corresponding to the server version number rarely changes during version updates. Based on this, the server performs field change operations on the target file corresponding to the server version number based on the field change log of the intermediate version number. These operations mostly add content corresponding to the fields in the field change log of the intermediate version number to the target file, and rarely involve modifying the content in the target cache data. This means that the content obtained by loading the target cache data is rarely modified, thereby reducing repeated calculations.

[0070] In one embodiment, if the version prefixes of the server version number corresponding to the target cache data differ by 1 or 0 from the version number of the first end, for example, the server version number and the first end version number are "V3.0.1" and "V3.1.0" respectively; or "V3.0.1" and "V4.1.0" respectively, then when updating the target file of the server version number to the target file of the first end version number, it is not necessary to use the target file of the intermediate version number as a transition version, and the version update can be performed on the basis of the target file of the server version number to obtain the target file of the first end version number. That is to say, in this case, steps S132 and S134 can be skipped, and based on the target file corresponding to the server version number obtained in step S133, the content of the target file corresponding to the server version number can be changed using the field change log corresponding to the first end version to obtain the target file of the first end version.

[0071] S135. The server changes the target content of the target file of the first-end version based on the target field to obtain a changed target file.

[0072] When the server obtains the first-end version of the target file, and the server's target file matches the target file version for which the content change request submitted by the first client applies, the server can perform content change processing on the first-end version of the target file based on the target field. The target file obtained by performing content change processing on the first-end version of the target file based on the target field is recorded as the modified target file.

[0073] S136: The server increments the version number of the first end to obtain the latest version of the target file.

[0074] When the server generates a modified target file, before performing a new content synchronization task, the content of the modified target file is the current latest version of the target file. Based on this, the latest version number is assigned to the modified target file to obtain the latest version of the target file. In this case, the latest version number can be obtained by incrementing the first-side version number. The incrementing rules for the version number are not restricted here.

[0075] In some embodiments of the present disclosure, the content change method M10 may further include: Figure 8 Steps S18 to S19 are shown.

[0076] S18. The server determines, as changed fields, the fields in the target file of the latest version that are changed relative to the target file of the second client subscribing to the server.

[0077] In one embodiment, the server pushes the latest version of a target file to subscribed clients based on a subscription mechanism. In a multi-user collaborative editing scenario, the client that proactively requests a synchronous update of the target file's content from the server is recorded 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 recorded as the second client in this content synchronization task.

[0078] Combined with the target content change strategy described above, when the target content needs to be changed, a simple modification of the target content change's minimal response field is sufficient to achieve the desired change. Based on this, when synchronizing the latest version of the target file to a second client, the second client can similarly modify the target file's content using field-level modification operations. Therefore, a client only needs to transmit field-level data to meet the second client's content synchronization needs, ensuring the accuracy of synchronized data and reducing network transmission burden.

[0079] Among them, the content difference between the target file of the second client and the target file of the latest version of the server is not necessarily limited to the difference between the target content requested to be changed by the first client 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 target file of the latest version of the server to determine all the content that needs to be changed when updating the version of the target file of the second client. Furthermore, on the basis that the second client supports content changes at the field granularity, the server can compare the field granularity difference between the target file of the latest version and the target file of the second client, and determine the field in the server that has changed relative to the target file of the second client as the changed field. The second client can perform a change operation on the local target file based on the changed field to update the local target file to a version consistent with the target file of the latest version of the server. In this way, when the new version of the content is pushed synchronously to the second client, the server does not need to transmit the complete data of the content that the second client needs to change, but only needs to transmit the data used to synchronize the content of the target file of the second client to the latest version. This can reduce the network transmission burden of the synchronization process.

[0080] S19. The server pushes the changed fields to the second client. The changed fields are used to synchronize the contents of the target file on the second client to the latest version. This allows the second client to synchronize the contents of the target file to the latest version through field-level content changes.

[0081] Regarding step S18, in some embodiments of the present disclosure, it may include the following Figure 9 Steps S181 to S184 are shown.

[0082] S181. The server obtains the latest version number of the target file of the second client and obtains the latest version number of the second end. In one embodiment, the server periodically sends an acquisition request to the second client for obtaining the version number of the target file, and the second client uploads the latest version number of the target file locally on the second client in response to the acquisition request. In this way, since the acquisition of the latest version number of the second end is periodic, it can be ensured that the frequency of the second client updating the version is at least one period apart, avoiding the situation where the latest version number of the server changes multiple times in a short period of time, and the latest version number does not match the latest version number of the second end multiple times, resulting in too frequent updates of the target file on the second end.

[0083] In another embodiment, the second client periodically sends the second-end latest version number to the server. In this way, when the second client does not need to update the target file version, it can operate on the second client to refuse to send the second-end latest version number to the server, so that the second client has the right to actively update.

[0084] In another embodiment, when the server generates the latest version of the target file, the server sends an acquisition request for the target file version number to each second client with which it has a subscription relationship, thereby ensuring that the latest version of the target file is pushed to the second client in a timely manner.

[0085] S182. 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.

[0086] In one embodiment, in a multi-user collaborative editing scenario, the server always generates the latest version of the target file and then synchronizes the target file versions of each client. Based on this, the version number of the target file stored on the server includes the version number of the target file of each client.

[0087] In one embodiment, the server's database persistently stores various versions of target files. When the second-end version of the target file needs to be obtained, the server queries the database for the target file corresponding to the latest version number of the second end to obtain the second-end version of the target file.

[0088] S183, the server compares the content differences between the latest version of the target file and the second version of the target file, and obtains the server content and the second client content that have differences. The content differences include added content, deleted content and modified content. Assume that the latest version of the target file has Figure 1 With the second end version Figure 1 If it is a different picture, then confirm Figure 1 There are differences in the content of Figure 1The content of the second client Figure 1 content.

[0089] S184: The server compares the field differences between the different server content and the second client content, and determines the changed fields of the different server content relative to the second client content.

[0090] Assume that the server Figure 1 It can be obtained by obtaining the picture of address A, the second client Figure 1 It can be obtained by obtaining the image of address B, then address A is the server with the difference Figure 1 Relative to the second client Figure 1 Based on this, address A can be used to change the second client's Figure 1 The content is synchronized with the server Figure 1 The content is consistent.

[0091] Based on any of the above embodiments, the present disclosure further provides a content changing device, which can be configured at the server in the embodiments of the present disclosure. Figure 10 This is a schematic block diagram of the structure of a content changing device according to an embodiment of the present disclosure. Figure 10 As 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 first client's request to change the target content of a target file and obtain a target field in the change request used to change the target content. The file generation module 120 is configured to generate the latest version of the target file based on the target cache data and target field corresponding to the target file on the server. The change frequency acquisition module 130 is configured to obtain 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 falls below a preset change frequency threshold.

[0093] The above-mentioned content changing device can be computer software, and its various modules can be computer software modules. The implementation process of the functions and effects of each module in the above-mentioned content changing device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0094] Based on any of the above embodiments, the present disclosure further provides an electronic device, which can execute the content changing method of any of the above embodiments of the present disclosure.

[0095] Figure 11 1 is a schematic block diagram of the structure of an electronic device 1000 according to 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 interconnecting buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300, and / or hardware modules. The bus 1100 can also connect various other circuits 1400 such as peripheral devices, voltage regulators, power management circuits, external antennas, etc.

[0097] Bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component Architecture (EISA) bus. Buses can be classified as address buses, data buses, control buses, and the like. For ease of illustration, this figure shows only one connecting line, but this does not imply that there is only one bus or only one type of bus.

[0098] The present disclosure also provides a readable storage medium having a computer program stored therein, which is used to implement the above-mentioned method when the computer program is executed by a processor. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable 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 methods of the present disclosure can be implemented in whole or in part using software, hardware, firmware, or any combination thereof. When implemented using software, they 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 programs or instructions are loaded and executed, the processes or functions of the present disclosure are performed in whole or in part.

[0100] A computer program or instruction can be stored in a readable storage medium or transferred from one readable storage medium to another. For example, a computer program or instruction can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. A readable storage medium can be any accessible medium or a data storage device such as a server or data center that integrates one or more accessible media. The accessible medium can be a magnetic medium such as a floppy disk, hard disk, or magnetic tape; an optical medium such as a digital video disk; or 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 will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0102] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable content synchronization device to produce a machine, so that the instructions executed by the processor of the computer or other programmable content synchronization device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0103] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable content synchronization device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, the instruction device being implemented in the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0104] These computer program instructions may also be loaded onto a computer or other programmable content synchronization device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0105] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in a suitable manner in any one or more embodiments / methods or examples. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and the features of different embodiments / methods or examples, unless they are contradictory.

[0106] Those skilled in the art will appreciate that the above embodiments are merely intended to clearly illustrate the present disclosure and are not intended to limit the scope of the present disclosure. Other changes or modifications may be made based on the above disclosure, and such changes or modifications are still within the scope of the present disclosure.

Claims

1. A content change method, characterized in that: include: The server, in response to a request from the first client to change target content of a target file, obtains a 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; as well as 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; The server generates the latest version of the target file based on the target cache data and the target field corresponding to the target file on the server, 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 first-end version of the target file; the server changes the target content of the first-end version of the target file based on the target field to obtain the changed target file; and the server performs version number incrementing processing on the first-end version number as the version number of the changed target file to obtain the latest version of the target file; The content changing method further includes: The server determines, as changed fields, the fields in the target file of the latest version that are changed relative to the target file of the second client subscribing to the server; and 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.

2. The content changing method according to claim 1, characterized in that: The server determines the changed fields in the target file of the latest version that are changed relative to the target file of the second client, including: The server obtains the latest version number of the target file from the second client and obtains the latest version number of the second client; 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 second-end version of the target file to obtain the server-end content and the second-end content that have differences; and The server compares the field differences between the different server content and the second client content, and determines the changed fields of the different server content relative to the second client content.

3. The content changing method according to claim 1, characterized in that: The target content change request includes a query request for the target content; the target field for changing the target content includes a target field for acquiring the target content; Obtaining a target field in the change request for changing the target content includes: The server parses the query request and identifies the type of the target content requested by the first client; as well as The server generates a target field for acquiring the target content based on the type of the target content.

4. The content changing method according to claim 3, characterized in that: Also includes: The server returns the target field and the version number of the latest version to the first client.

5. The content changing method according to claim 1, wherein: Also 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.

6. An electronic device, characterized in that: include: a memory storing execution instructions; as well as A processor, wherein the processor executes the execution instruction stored in the memory, so that the processor executes the content changing method according to any one of claims 1 to 5.

7. A readable storage medium, characterized in that: The readable storage medium stores an execution instruction, and when the execution instruction is executed by the processor, it is used to implement the content changing method according to any one of claims 1 to 5.

8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the content changing method according to any one of claims 1 to 5 is implemented.

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