Cache draft backup method and device based on sliding window

By using a cached draft backup method with sliding windows and chain structure in video clips, using the secondary cache of memory and disks, the problem of draft backup occupies a large amount of memory in video clips is solved, and efficient draft management and quick operation are achieved.

CN119603515APending Publication Date: 2025-03-11SHANGHAI BILIBILI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411769294.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

During video editing, frequent draft backups lead to excessive memory usage, affecting the editing operation and the operation efficiency of the equipment.

Method used

The cache draft backup method based on the sliding window is used, and it is stored through memory and disk secondary cache. The drafts of the chain structure node located in the sliding window are stored in memory, and the drafts of the nodes outside the sliding window are stored on the disk, reducing the memory storage pressure.

Benefits of technology

It realizes quick acquisition of the latest version of drafts, reduces memory usage, improves the efficiency of editing operations, and supports undo and redo operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119603515A_ABST
    Figure CN119603515A_ABST
Patent Text Reader

Abstract

The invention discloses a cache draft backup method and device based on a sliding window, and the method comprises the steps: responding to a draft backup operation triggered by a user, and determining a current node of a chain structure according to a backup pointer; the chain structure is stored in a memory and comprises a sliding window with a preset length; the backup pointer points to a node of the draft of the latest version; storing the draft in a memory, recording a memory storage address of the draft at a next node of the current node, and moving the sliding window to move the backup pointer to the next node of the current node; whether a node of a chain structure located outside the sliding window exists or not is judged, and a memory storage address is recorded in the node; if yes, the corresponding draft in the node is transferred from the memory to a disk for storage, and the node is updated to a disk storage address; and responding to draft revocation operation or redo operation triggered by the user, moving the sliding window, acquiring the corresponding node in the chain structure, and acquiring the corresponding draft according to the memory storage address recorded by the node to return.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of video editing, and in particular to a method and device for backing up a cached draft based on a sliding window. Background Art

[0002] During the video editing process, you may need to save video drafts frequently to avoid data loss. As the editing time increases and the complexity of the draft increases, the amount of draft backup data will increase dramatically, and the backup limit will often exceed 30 copies. The existing draft backup method is to back up all video drafts in memory, which takes up a lot of memory resources, affecting the editing operation and even the operating efficiency of the operating device. Summary of the invention

[0003] In view of the above problems, embodiments of the present application are proposed to provide a method and device for backing up cache drafts based on a sliding window that overcomes the above problems or at least partially solves the above problems.

[0004] According to a first aspect of an embodiment of the present application, a sliding window-based cache draft backup method is provided, which includes:

[0005] In response to a draft backup operation triggered by a user, the current node of the chain structure is determined according to the backup pointer; the chain structure is stored in the memory, including a sliding window of a preset length; the backup pointer points to the node of the latest version of the draft;

[0006] The draft is stored in the memory, and the memory storage address of the draft is recorded in the next node of the current node, and the sliding window is moved to move the backup pointer to the next node of the current node;

[0007] Determine whether there is a node of the chain structure outside the sliding window, and the memory storage address has been recorded in the node;

[0008] If so, transfer the corresponding draft in the node from memory to disk storage, and update the node to the disk storage address;

[0009] In response to the draft undo operation or redo operation triggered by the user, the sliding window is moved to obtain the corresponding node in the chain structure, so as to obtain the corresponding draft return according to the memory storage address recorded in the node.

[0010] Optionally, the method further comprises:

[0011] According to the sliding window, nodes with recorded memory storage addresses in the chain structure outside the sliding window are subjected to disk persistence processing, and / or nodes in the link structure adjacent to the sliding window are subjected to disk recovery processing.

[0012] Optionally, in response to a draft undo operation or redo operation triggered by a user, moving the sliding window, acquiring a corresponding node in the chain structure, and acquiring a corresponding draft return according to a memory storage address recorded in the node further includes:

[0013] In response to the draft revocation operation triggered by the user, the sliding window is moved to the previous node of the current node, the backup pointer is moved to the previous node of the current node, the memory storage address recorded in the previous node is obtained, and the corresponding draft is returned;

[0014] After the draft revocation operation, according to the sliding window, performing disk persistence processing on the nodes with recorded memory storage addresses in the chain structure outside the sliding window, and / or performing disk recovery processing on the nodes of the link structure adjacent to the sliding window further includes:

[0015] According to the preset length of the sliding window and the position of the backup pointer, the next node of the chain structure node at the end of the sliding window is obtained;

[0016] Determine whether the next node has recorded the memory storage address;

[0017] If yes, transfer the corresponding draft in the next node from memory to disk storage, and update the record of the next node to the disk storage address;

[0018] Get the node of the chain structure at the initial end of the sliding window, get the disk storage address from the node, restore the draft from the disk to the memory storage, and update the record of the node to the memory storage address.

[0019] Optionally, in response to a draft undo operation or redo operation triggered by a user, moving the sliding window, acquiring a corresponding node in the chain structure, and acquiring a corresponding draft return according to a memory storage address recorded in the node further includes:

[0020] In response to the draft redo operation triggered by the user, the sliding window is moved to the node after the current node, the backup pointer is moved to the node after the current node, the memory storage address recorded in the node after the current node is obtained, and the corresponding draft is obtained and returned;

[0021] According to the sliding window, performing disk persistence processing on the nodes with recorded memory storage addresses in the chain structure outside the sliding window, and / or performing disk recovery processing on the nodes of the link structure adjacent to the sliding window further includes:

[0022] After the draft redo operation, according to the preset length of the sliding window and the position of the backup pointer, the previous node of the chain structure node at the initial end of the sliding window is obtained, the corresponding draft in the previous node is transferred from the memory to the disk storage, and the record of the previous node is updated to the disk storage address;

[0023] Get the node of the chain structure at the end of the sliding window;

[0024] Determine whether the node has recorded the disk storage address;

[0025] If so, obtain the disk storage address from the node, restore the draft from disk to memory storage, and update the node's record to the memory storage address.

[0026] Optionally, before responding to a draft undo operation or redo operation triggered by a user, the method further includes:

[0027] Determine the current node of the chain structure according to the backup pointer, and judge whether the record of the previous node of the current node is empty;

[0028] If not, the undo operation is displayed in the draft editing interface so that the user can trigger the undo operation.

[0029] Optionally, before responding to a draft undo operation or redo operation triggered by a user, the method further includes:

[0030] Determine the current node of the chain structure according to the backup pointer, and judge whether the record of the next node after the current node is empty;

[0031] If not, a redo operation is displayed in the draft editing interface so that the user can trigger the redo operation.

[0032] Optionally, after storing the draft in the memory, recording the memory storage address of the draft in the next node of the current node, and moving the sliding window to move the backup pointer to the next node of the current node, the method further includes:

[0033] Determine the current node of the chain structure according to the backup pointer, and delete the records of each node after the current node.

[0034] Optionally, in response to the draft backup operation triggered by the user, after determining the current node of the chain structure according to the backup pointer, the method further includes:

[0035] Determine whether the storage address is recorded in the current node;

[0036] If not, store the draft in memory and record the memory storage address of the draft at the current node;

[0037] If so, the draft is stored in the memory, and the memory storage address of the draft is recorded in the next node of the current node, and the sliding window is moved to move the backup pointer to the next node of the current node.

[0038] According to a second aspect of an embodiment of the present application, a sliding window-based cache draft backup device is provided, comprising:

[0039] The node determination module is adapted to respond to the draft backup operation triggered by the user, and to determine the current node of the chain structure according to the backup pointer; the chain structure is stored in the memory, and includes a sliding window of a preset length; the backup pointer points to the node of the latest version of the draft;

[0040] A memory storage module, adapted to store the draft into a memory, record the memory storage address of the draft at a node next to the current node, and move the sliding window to move the backup pointer to a node next to the current node;

[0041] The disk storage module is adapted to determine whether there is a node of the chain structure outside the sliding window, and the memory storage address is recorded in the node; if so, the corresponding draft in the node is transferred from the memory to the disk storage, and the node is updated to the disk storage address;

[0042] The moving module is suitable for responding to the draft undo operation or redo operation triggered by the user, moving the sliding window, obtaining the corresponding node in the chain structure, and obtaining the corresponding draft return according to the memory storage address recorded in the node.

[0043] According to a third aspect of an embodiment of the present application, there is provided a computing device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0044] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the above-mentioned cache draft backup method based on sliding window.

[0045] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned sliding window-based cache draft backup method.

[0046] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the above-mentioned cache draft backup method based on a sliding window.

[0047] According to the sliding window-based cache draft backup method and device provided by the present application, storage is performed through memory and disk secondary cache. The corresponding drafts of the nodes of the chain structure within the sliding window are stored in the memory, which is convenient for quickly obtaining the latest version of the draft from the memory. The corresponding drafts of the nodes of the chain structure outside the sliding window are stored on the disk, which reduces the storage pressure of the memory. The sliding window and the chain structure are used to facilitate users to quickly obtain the corresponding drafts when performing undo and redo operations through the sliding of the sliding window and the front and back nodes of the chain structure.

[0048] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0050] Figure 1 A flow chart of a cache draft backup method based on a sliding window according to an embodiment of the present application is shown;

[0051] Figure 2 A flow chart of a cache draft backup method based on a sliding window according to another embodiment of the present application is shown;

[0052] Figure 3 A schematic diagram of chain structure and sliding window storage draft is shown;

[0053] Figure 4 A schematic structural diagram of a cache draft backup device based on a sliding window according to an embodiment of the present application is shown;

[0054] Figure 5 A schematic diagram of the structure of a computing device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0055] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0056] First, the terms involved in one or more embodiments of the present application are explained.

[0057] Editing draft backup: During the video editing process, in order to save the editing progress, the editing draft data is backed up.

[0058] Sliding Window: A technique for processing data streams or arrays by maintaining a fixed-size window that slides over the data to process or analyze it.

[0059] Secondary cache: A data cache mechanism that combines memory and disk storage media. Memory provides high-speed access, and disk provides large-capacity storage. Draft data can be stored persistently in files.

[0060] Chain structure: Data elements are connected to each other through pointers or references to form a chain-like data structure.

[0061] Undo: The undo operation in the editing software.

[0062] redo: Redo operation in editing software.

[0063] Figure 1 A flow chart of a method for backing up a cached draft based on a sliding window according to an embodiment of the present application is shown. Figure 1 As shown, the method comprises the following steps:

[0064] Step S101, responding to a draft backup operation triggered by a user, determining a current node of the chain structure according to a backup pointer.

[0065] During the video editing process, in order to save the editing process, the user may need to store the editing draft (hereinafter referred to as the draft) multiple times for backup, undo or redo the currently edited draft, etc. Taking into account various operations on the draft, this embodiment adopts a chain structure and a sliding window method. The previous and next versions of the draft can be easily found through the front and back relationships of the nodes in the chain structure. The backup pointer of the sliding window can accurately locate the current node, that is, accurately locate the latest version of the draft, so that backup storage, undo or redo operations, etc. can be performed based on the latest version of the draft, thereby realizing a quick and timely response to operations triggered by the user.

[0066] Specifically, when the user triggers the draft backup operation in the editing interface of the video draft, in response to the draft backup operation triggered by the user, the backup pointer of the sliding window is first obtained, and the current node in the chain structure is determined according to the backup pointer. Among them, the chain structure is stored in the memory, and there are multiple nodes in the chain structure. The previous node or the next node of the node can be determined by the pointer between the nodes. The storage address of the draft is recorded in the node of the chain structure, which is convenient for obtaining the corresponding draft according to the storage address. After the chain structure is formed, the chain structure also includes a sliding window of a preset length. The sliding window can move between the nodes of the chain structure, and the backup pointer points to the node of the latest version of the draft. The preset length of the sliding window can be set according to the implementation situation, such as setting it to 5, that is, the sliding window covers 5 nodes in the chain structure.

[0067] This embodiment adopts a secondary cache method for the draft, including memory storage and disk storage. The nodes of the chain structure in the sliding window are used to record the memory storage address of the draft, which is convenient for quickly obtaining the draft from the memory. The nodes of the chain structure outside the sliding window are used to record the disk storage address of the draft, reducing the storage pressure of the memory. The preset length of the sliding window determines the number of copies of the draft stored in the memory, which can be determined according to the storage capacity of the memory, the size of the draft, the draft backup requirements, etc.

[0068] Step S102, storing the draft in the memory, and recording the memory storage address of the draft in the next node of the current node, and moving the sliding window to move the backup pointer to the next node of the current node.

[0069] After determining the current node, the draft can be stored in the memory, and the memory storage address of the draft stored in the memory can be recorded in the next node of the current node in the chain structure, so that the stored draft can be quickly obtained from the memory according to the memory storage address. After recording the memory storage address of the draft, the sliding window can be moved to move the backup pointer to the next node of the current node, so that the backup pointer continues to point to the node of the latest version of the draft. The position of the backup pointer is fixed after setting. For example, the preset length of the sliding window is 5, and the backup pointer is fixed to the position of the third node in the sliding window, that is, the backup pointer points to the position of the middle node contained in the sliding window, which is convenient for subsequent undo operations to move the sliding window to obtain the previous version of the latest version of the draft, or to perform a redo operation after the undo operation, move the sliding window, and obtain the next version of the currently displayed draft.

[0070] Furthermore, the position of the backup pointer in the sliding window can be set according to the implementation situation, such as being set at the second position of the sliding window, or being set at the fourth position of the sliding window, etc. It can also be specifically determined based on the user's historical operations in editing the video draft. For example, if the user's historical operations mostly use the undo operation, the backup pointer can be set at a later position in the sliding window to retain multiple versions of the draft for the user, making it convenient to quickly undo to the previous version; if the user's historical operations mostly use the redo operation, the backup pointer can be set at a earlier position in the sliding window to facilitate quickly redoing to the next version, etc., which is not limited here.

[0071] Furthermore, when the draft has not been stored in the node of the chain structure, it is determined whether the storage address is recorded in the current node. If so, it means that the current node has stored the memory storage address of the draft, and the memory storage address of the draft is recorded in the next node of the current node. If not, it means that the current node is an empty node. After the draft is stored in the memory, the memory storage address of the draft is directly recorded in the current node. The backup pointer does not need to be moved and can point to the current node.

[0072] Step S103, determining whether there is a node of the chain structure outside the sliding window, and whether the node has a memory storage address recorded therein.

[0073] After the draft is backed up and stored, in order to reduce the storage pressure of the memory, it is necessary to further consider whether the number of stored drafts has exceeded the preset length of the sliding window. If it has exceeded the preset length of the sliding window, the draft stored in the memory can be persisted to the disk to reduce the storage space occupied by the memory; or, the node storing the memory storage address is already outside the sliding window. If there are too many nodes that can be used for undo operations, there is no need to store too many versions in the memory. The draft stored in the memory can be persisted to the disk, etc.

[0074] Specifically, if it is determined whether there are nodes of a chain structure located outside the sliding window, and the memory storage address has been recorded in the node, if the above conditions are met, the drafts corresponding to these nodes need to be transferred from the memory to the disk storage, and step S104 can be executed. If the above conditions are not met, no processing is required.

[0075] Step S104, transferring the corresponding draft in the node from the memory to the disk storage, and updating the node to the disk storage address.

[0076] When it is determined that the conditions of step S103 are met, the memory storage address can be first obtained from the node, and the draft can be determined based on the memory storage address. The draft is transferred from the memory storage to the disk for storage. At the same time, the node record is updated to the disk storage address to reduce the storage pressure of the memory.

[0077] Step S105, in response to the draft undo operation or redo operation triggered by the user, the sliding window is moved to obtain the corresponding node in the chain structure, so as to obtain the corresponding draft return according to the memory storage address recorded in the node.

[0078] Based on the chain structure and sliding window, nodes can be easily located, so that when performing undo operations or redo operations on the draft, the current version can be determined by moving the sliding window, and the previous node or next node of the node in the chain structure can be obtained, thereby obtaining the previous version or next version of the draft and quickly returning.

[0079] Specifically, in response to the draft undo operation triggered by the user, according to the draft undo operation, it is necessary to obtain the previous version of the current version of the draft. This can be done by moving the sliding window, such as determining the current node, moving to the previous node, and obtaining the memory storage address recorded in the previous node according to the chain structure, and then obtaining the previous version of the draft stored in the memory, and returning it to the business layer, so that the user can edit based on the previous version.

[0080] In response to the draft redo operation triggered by the user, according to the draft redo operation, it is necessary to obtain the next version of the current draft. This can be done by moving the sliding window, such as determining the current node, moving to the next node, and obtaining the memory storage address recorded in the next node according to the chain structure, and then obtaining the next version of the draft stored in the memory, and returning it to the business layer, so that users can edit based on the next version.

[0081] According to the cached draft backup method based on sliding window provided by the present application, storage is performed through memory and disk secondary cache. The corresponding drafts of the nodes of the chain structure within the sliding window are stored in the memory, which is convenient for quickly obtaining the latest version of the draft from the memory. The corresponding drafts of the nodes of the chain structure outside the sliding window are stored on the disk, which reduces the storage pressure of the memory. The sliding window and chain structure are used to facilitate users to quickly obtain the corresponding drafts through the sliding of the sliding window and the front and back nodes of the chain structure when performing undo and redo operations.

[0082] Figure 2 A flow chart of a method for backing up a cached draft based on a sliding window according to an embodiment of the present application is shown. Figure 2 As shown, the method comprises the following steps:

[0083] Step S201, responding to a draft backup operation triggered by a user, determining a current node of the chain structure according to a backup pointer.

[0084] The user operates the draft in the video editing interface, and in response to the draft backup operation triggered by the user, the draft of the current version of the video editing interface needs to be stored. Considering that when the user edits the video draft, it may involve the need to store multiple versions of the draft, and may also perform undo operations, redo operations, etc. on the draft, and need to read between different versions. Therefore, this embodiment adopts a sliding window and a chain structure to facilitate the rapid positioning of the current version of the draft, and the previous version or the next version of the draft can be easily obtained according to the chain structure. The sliding window can control the number of drafts stored in the memory, and the drafts outside the sliding window can be stored to the disk in time to reduce the storage pressure of the memory, and the drafts stored in the disk can be restored to the memory storage in time to facilitate quick reading, etc.

[0085] For the sliding window, it includes a preset length. The preset length can be set according to the implementation situation and is not limited here. The position of the backup pointer in the sliding window can be set according to the implementation situation. After the position of the backup pointer is determined, the position of the backup pointer is fixed. For example, if the backup pointer is set at the third position of the sliding window, no matter how the sliding window is moved subsequently, the backup pointer is still fixed at the third position of the sliding window. The backup pointer points to the latest version of the draft. The current node of the chain structure is determined based on the backup pointer, that is, the node that records the memory storage address of the latest version of the draft. In response to the draft backup operation triggered by the user, it is necessary to save the draft in the current editing interface based on the latest version of the draft that has been stored. Therefore, the current node in the chain structure is first determined based on the backup pointer of the sliding window. Figure 3 As shown, the green part is the node of the chain structure of the sliding window, which corresponds to the memory storage address of the memory. The gray part is the node of the chain structure outside the sliding window, which corresponds to the disk storage address of the disk. The backup pointer at the third position of the sliding window is the backup pointer position, pointing to the data backup of the latest version of the draft. The node on the left side of the backup pointer can be used for undo operation to obtain the corresponding backup node, and the node on the right side of the backup pointer can be used for redo operation to obtain the corresponding backup node.

[0086] Step S202, determining whether the storage address is recorded in the current node.

[0087] After determining the current node according to the backup pointer, it can be determined whether the storage address is recorded in the current node. If the storage address is not recorded, such as Figure 3 As shown in the first row, the current node is empty and no backup storage address is recorded, and step S203 is executed; otherwise, step S204 is executed.

[0088] Step S203, storing the draft in the memory, and recording the memory storage address of the draft at the current node.

[0089] When the storage address is not recorded in the current node, the draft is first stored in the memory, and the memory storage address of the draft in the memory is recorded in the current node, such as Figure 3 As shown in the second line of , the node pointed to by the backup pointer records backup 1, which corresponds to the memory storage address of the draft backup 1 in the memory.

[0090] Step S204, storing the draft in the memory, and recording the memory storage address of the draft in the next node of the current node, and moving the sliding window to move the backup pointer to the next node of the current node.

[0091] When the storage address has been recorded in the current node, the draft is first stored in the memory, and the memory storage address of the draft in the memory is recorded in the next node of the current node in the chain structure. The sliding window moves the backup pointer to the next node of the current node, so that the backup pointer keeps pointing to the latest version of the backup. Figure 3 As shown in the third row in , after the sliding window moves, the backup pointer points to the node where the backup 7 is newly stored.

[0092] Step S205, determining the current node of the chain structure according to the backup pointer, and deleting the records of each node after the current node.

[0093] Considering that users may perform multiple undo operations when editing videos, and then perform new editing based on the draft of the version corresponding to the undo operation, and perform a backup operation on the draft of the new editing, there may be the following situation: Figure 3 As shown in the sixth row of , at this time, the backup pointer is executing backup 5. After the user performs editing on the draft of backup 5, the draft of backup 8 is obtained. The draft of backup 8 is backed up and stored. Figure 3 As shown in line 7 of , the memory storage address corresponding to backup 8 is stored in the node after backup 5, and the backup pointer moves to the node where backup 8 is located. At this time, the node where backup 8 is located is the current node. The draft of backup 8 is obtained after the undo operation, and the editing operation is performed on it. The versions of backup 6 and backup 7 after backup 5 are invalid drafts and do not need to be stored. Therefore, the records of each node after the current node are deleted, that is, the records of backup 6 and backup 7 are deleted, and the result is as follows Figure 3 The storage result is shown in row 7 of .

[0094] Furthermore, before deleting the records of each node after the current node, the nodes after the current node may be judged. If the storage address of the nodes after the current node is not recorded, the deletion process may not be performed.

[0095] Step S206, determining the current node of the chain structure according to the backup pointer, and judging whether the record of the previous node of the current node is empty.

[0096] In addition to backing up the draft, you can also perform undo and redo operations on the draft. The undo operation is to obtain the draft of the previous version of the current version, and the redo operation is to obtain the draft of the next version of the current version. Before performing undo and redo operations on the draft, you need to further determine whether the corresponding version of the draft is stored in the node of the chain structure to ensure that the draft can be undo and redo.

[0097] When judging, the current node of the chain structure can be determined according to the backup pointer, and the previous node can be searched forward according to the current node to determine whether the record of the previous node is empty. If not, it means that there is a draft of the previous version, and step S207 is executed, and the user can perform the undo operation. Figure 3 As shown in the third line, the current node corresponds to backup version 7, and the previous node records backup version 6. The user can perform the undo operation. Figure 3 As shown in the second line, the current node corresponds to backup version 1, and the record in the previous node is empty, so the user cannot perform the undo operation.

[0098] Step S207, displaying an undo operation on the draft editing interface so that the user can trigger the undo operation.

[0099] The record of the current node is not empty, which means that the user can perform an undo operation. The undo operation can be displayed on the draft editing interface. The user can trigger the undo operation and obtain the previous version of the draft for editing.

[0100] Step S208, determining the current node of the chain structure according to the backup pointer, and judging whether the record of the next node after the current node is empty.

[0101] For the redo operation, when judging, you can first determine the current node of the chain structure based on the backup pointer, and then search for the next node based on the current node to determine whether the record of the next node is empty. If not, it means that there is a draft of the next version. Execute step S209 and the user can perform the redo operation.

[0102] like Figure 3 As shown in the third line, the current node corresponds to backup version 7, and the record of the next node is empty, so the user cannot perform redo operations. Figure 3 As shown in the 4th line, the current node corresponds to backup version 6, and the next node records backup version 7. The user can perform redo operations.

[0103] Step S209, displaying the redo operation on the draft editing interface so that the user can trigger the redo operation.

[0104] When the record of the next node is not empty, it means that the user can perform a redo operation. The redo operation can be displayed on the draft editing interface. The user can trigger the redo operation and obtain the next version of the draft for editing.

[0105] Step S210, in response to the draft undo operation or redo operation triggered by the user, the sliding window is moved to obtain the corresponding node in the chain structure, so as to obtain the corresponding draft return according to the memory storage address recorded in the node.

[0106] When the user triggers the draft revocation operation, in response to the draft revocation operation triggered by the user, the sliding window is moved to the previous node of the current node, such as Figure 3 As shown in the third line, the backup version 7 corresponding to the current node at this time, when the user triggers the undo operation, the backup pointer is moved to the previous node of the current node, the memory storage address recorded in the previous node is obtained, and the corresponding draft is obtained and returned, such as Figure 3 As shown in line 4, the sliding window moves forward, and the backup pointer points to the node of backup version 6. The memory storage address of backup version 6 is obtained from the node, and the draft of backup version 6 is obtained and returned to the user for display and convenient processing. The user can trigger the undo operation multiple times, such as from Figure 3 In line 4, two undo operations are triggered, the sliding window moves forward twice, the backup pointer points to the node of backup version 4, the memory storage address of backup version 4 is obtained from the node, and the draft of backup version 4 is obtained.

[0107] When the user triggers the draft redo operation, in response to the draft redo operation triggered by the user, the sliding window is moved to the node after the current node, such as Figure 3 As shown in line 5, the backup version 4 corresponding to the current node at this time, when the user triggers the redo operation, the backup pointer is moved to the node after the current node, the memory storage address recorded in the node after the current node is obtained, and the corresponding draft is obtained and returned. Figure 3 As shown in line 6, the sliding window moves backward, and the backup pointer points to the node of backup version 5. The memory storage address of backup version 5 is obtained from the node, and the draft of backup version 5 is obtained and returned to the user for display to facilitate user processing.

[0108] Step S211, according to the sliding window, the nodes with recorded memory storage addresses in the chain structure outside the sliding window are subjected to disk persistence processing, and / or the nodes of the link structure adjacent to the sliding window are subjected to disk recovery processing.

[0109] After the sliding window is moved, the storage address of the node record in the chain structure covered by the sliding window needs to change accordingly. For example, if the node was originally covered by the sliding window, it will no longer be covered by the sliding window after the sliding window moves, and it is far away from the node pointed to by the backup pointer. The corresponding draft will not be used frequently and needs to be persisted on the disk. If the node was not originally covered by the sliding window, it will be covered by the sliding window after the sliding window moves, and it is close to the node pointed to by the backup pointer. The corresponding draft may be used and needs to be restored on the disk. During processing, a new thread can be used for asynchronous execution without affecting the operation of the current editing interface.

[0110] Specifically, after the undo operation, the preset length can be determined according to the sliding window, and the next node of the chain structure node at the end of the sliding window can be obtained according to the preset length and the position of the backup pointer, such as Figure 3 In the example, the preset length of the sliding window is 5, and the backup pointer is located at the third position of the sliding window. The next node of the chain structure node at the end of the sliding window can be obtained by going back 3 nodes from the node pointed by the backup pointer. It is determined whether the next node has a memory storage address. If so, the corresponding draft in the next node can be stored from the memory to the disk, and the record of the next node can be updated to the disk storage address. Figure 3 As shown in the 5th line, after two undo operations pointed to by the 4th line, the node corresponding to the original backup version 7 moves from the coverage of the sliding window to the outside of the sliding window, and the draft of the backup version 7 can be stored from the memory to the disk, and the record of the node is updated to the disk storage address of the draft of the backup version 7. Furthermore, in addition to the above disk persistence processing, the preset length of the sliding window and the position of the backup pointer can be used to obtain the node of the chain structure at the initial end of the sliding window, such as going forward 2 nodes from the node pointed to by the backup pointer to obtain the node of the chain structure at the initial end of the sliding window. Due to the undo operation, the sliding window moves to the previous node of the current node, and the node originally located outside the sliding window is moved to the coverage of the sliding window. Therefore, the disk storage address of the original record is obtained from the node at the initial end of the sliding window, the draft is restored from the disk to the memory storage, and the record of the node is updated to the memory storage address, which is convenient and quick to obtain. As Figure 3 From the 4th line, two undo operations are performed to the storage result shown in the 5th line. The drafts of the original backup 3 and backup 2 versions need to be restored from the disk to the memory storage, and the memory storage addresses are recorded in the corresponding nodes.

[0111] After the redo operation, the preset length can be determined according to the sliding window. According to the preset length and the position of the backup pointer, the previous node of the chain structure node at the initial end of the sliding window can be obtained, and the corresponding draft in the previous node is stored from the memory to the disk three nodes forward from the node pointed to by the backup pointer, and the record of the previous node is updated to the disk storage address. Figure 3 In line 5, a redo operation is performed to obtain the storage result shown in line 6. The sliding window moves backward according to the redo operation, and the draft of backup version 2 needs to be moved from memory to disk storage. Furthermore, in addition to the above disk persistence processing, it is also necessary to obtain the node of the chain structure at the end of the sliding window, such as 2 nodes backward from the node pointed to by the backup pointer, to determine whether the node has recorded the disk storage address. If so, obtain the disk storage address from the node, restore the draft from the disk to the memory storage, and update the node record to the memory storage address. Correspondingly, Figure 3The draft of backup version 7 in line 6 needs to be restored from disk to memory storage, and the memory storage address is recorded in the corresponding node.

[0112] After the sliding window moves, the corresponding nodes with recorded memory storage addresses in the chain structure outside the sliding window are persisted on disk, and the nodes of the link structure adjacent to the sliding window are restored on disk to ensure that the corresponding draft can be quickly obtained from the memory when needed, and that the versions that are not frequently used can be stored on disk to reduce memory storage pressure.

[0113] According to the cache draft backup method based on sliding window provided by the present application, the nodes of the chain structure located in the sliding window are stored in memory, and the corresponding draft can be quickly obtained. The sliding window can be moved, and the front and back nodes of the chain structure are added to facilitate the acquisition of the corresponding version of the draft for the undo operation and the redo operation. The draft that is far from the backup pointer can also be moved from the memory to the disk storage according to the sliding window to reduce the storage pressure of the memory, obtain the nodes within the new coverage range after the sliding window moves, and restore the draft from the disk to the memory storage, which is convenient for subsequent rapid acquisition.

[0114] Figure 4 FIG. 1 shows a schematic diagram of a cache draft backup device based on a sliding window provided in an embodiment of the present application. Figure 4 As shown, the device comprises:

[0115] The node determination module 410 is adapted to respond to the draft backup operation triggered by the user, and determine the current node of the chain structure according to the backup pointer; the chain structure is stored in the memory, and includes a sliding window of a preset length; the backup pointer points to the node of the latest version of the draft;

[0116] A memory storage module 420, adapted to store the draft into the memory, record the memory storage address of the draft at the next node of the current node, and move the sliding window to move the backup pointer to the next node of the current node;

[0117] The disk storage module 430 is adapted to determine whether there is a node of the chain structure outside the sliding window, and the memory storage address is recorded in the node; if so, the corresponding draft in the node is transferred from the memory to the disk storage, and the node is updated to the disk storage address;

[0118] The moving module 440 is adapted to respond to a draft undo operation or redo operation triggered by a user, move the sliding window, and obtain the corresponding node in the chain structure to obtain the corresponding draft return according to the memory storage address recorded in the node.

[0119] Optionally, the device also includes: a storage processing module 450, which is suitable for performing disk persistence processing on the nodes with recorded memory storage addresses in the chain structure located outside the sliding window according to the sliding window, and / or performing disk recovery processing on the nodes of the link structure adjacent to the sliding window.

[0120] Optionally, the movement module 440 is further adapted to:

[0121] In response to the draft revocation operation triggered by the user, the sliding window is moved to the previous node of the current node, the backup pointer is moved to the previous node of the current node, the memory storage address recorded in the previous node is obtained, and the corresponding draft is returned;

[0122] The storage processing module 450 is further adapted to:

[0123] After the draft undo operation, the next node of the chain structure node at the end of the sliding window is obtained according to the preset length of the sliding window and the position of the backup pointer;

[0124] Determine whether the next node has recorded the memory storage address;

[0125] If yes, transfer the corresponding draft in the next node from memory to disk storage, and update the record of the next node to the disk storage address;

[0126] Get the node of the chain structure at the initial end of the sliding window, get the disk storage address from the node, restore the draft from the disk to the memory storage, and update the record of the node to the memory storage address.

[0127] Optionally, the movement module 440 is further adapted to:

[0128] In response to the draft redo operation triggered by the user, the sliding window is moved to the node after the current node, the backup pointer is moved to the node after the current node, the memory storage address recorded in the node after the current node is obtained, and the corresponding draft is obtained and returned;

[0129] The storage processing module 450 is further adapted to:

[0130] After the draft redo operation, according to the preset length of the sliding window and the position of the backup pointer, the previous node of the chain structure node at the initial end of the sliding window is obtained, the corresponding draft in the previous node is transferred from the memory to the disk storage, and the record of the previous node is updated to the disk storage address;

[0131] Get the node of the chain structure at the end of the sliding window;

[0132] Determine whether the node has recorded the disk storage address;

[0133] If so, obtain the disk storage address from the node, restore the draft from disk to memory storage, and update the node's record to the memory storage address.

[0134] Optionally, the device also includes: a pre-undo module 460, adapted to determine the current node of the chain structure according to the backup pointer, and determine whether the record of the previous node of the current node is empty; if not, displaying the undo operation in the draft editing interface for the user to trigger the undo operation.

[0135] Optionally, the device also includes: a pre-redo module 470, which is suitable for determining the current node of the chain structure according to the backup pointer, and judging whether the record of the next node after the current node is empty; if not, displaying the redo operation in the draft editing interface for the user to trigger the redo operation.

[0136] Optionally, the device further comprises: a deleting module 480, adapted to determine the current node of the chain structure according to the backup pointer, and delete the records of each node after the current node.

[0137] Optionally, the device also includes: a judgment module 490, suitable for judging whether the storage address is recorded in the current node; if not, the draft is stored in the memory, and the memory storage address of the draft is recorded in the current node; if so, the draft is stored in the memory, and the memory storage address of the draft is recorded in the next node of the current node, and the sliding window is moved to move the backup pointer to the next node of the current node.

[0138] The description of each module above refers to the corresponding description in the method embodiment and will not be repeated here.

[0139] According to the cached draft backup device based on sliding window provided by the present application, storage is performed through memory and disk secondary cache. The corresponding drafts of the nodes of the chain structure within the sliding window are stored in the memory, which is convenient for quickly obtaining the latest version of the draft from the memory. The corresponding drafts of the nodes of the chain structure outside the sliding window are stored on the disk, which reduces the storage pressure of the memory. The sliding window and chain structure are used to facilitate users to quickly obtain the corresponding drafts through the sliding of the sliding window and the front and back nodes of the chain structure when performing undo and redo operations.

[0140] The present application also provides a non-volatile computer storage medium, which stores at least one executable instruction, and the executable instruction can execute operations corresponding to the sliding window-based cache draft backup method in any of the above method embodiments.

[0141] The present application also provides a computer program product, which includes at least one executable instruction or computer program, which can enable a processor to perform operations corresponding to the sliding window-based cache draft backup method in any of the above-mentioned method embodiments.

[0142] Figure 5 A schematic diagram of the structure of a computing device according to an embodiment of the present application is shown. The specific embodiment of the present application does not limit the specific implementation of the computing device.

[0143] like Figure 5 As shown, the computing device may include: a processor (processor) 502 , a communications interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .

[0144] in:

[0145] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .

[0146] The communication interface 504 is used to communicate with other devices such as clients or other servers.

[0147] The processor 502 is used to execute the program 510, and specifically can execute the relevant steps in the above-mentioned embodiment of the cache draft backup method based on the sliding window.

[0148] Specifically, the program 510 may include program codes, which include computer operation instructions.

[0149] The processor 502 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the present application. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0150] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0151] Program 510 can be specifically used to enable processor 502 to execute the cache draft backup method based on sliding window in any of the above method embodiments. The specific implementation of each step in program 510 can refer to the corresponding description in the corresponding steps and units in the above cache draft backup embodiment based on sliding window, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiment, which will not be repeated here.

[0152] The algorithm or display provided here is not inherently related to any specific computer, virtual system or other device. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the application described here, and the above description of specific languages ​​is to disclose the preferred embodiment of the application.

[0153] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0154] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.

[0155] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0156] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0157] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0158] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be constructed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A cache draft backup method based on a sliding window, comprising: In response to the draft backup operation triggered by the user, the current node of the chain structure is determined according to the backup pointer; The chain structure is stored in the memory and includes a sliding window of a preset length; The backup pointer points to the node of the latest version of the draft; The draft is stored in a memory, and the memory storage address of the draft is recorded in a node next to the current node, and the sliding window is moved to move the backup pointer to a node next to the current node; Determine whether there is a node of the chain structure outside the sliding window, and the memory storage address is recorded in the node; If so, transfer the corresponding draft in the node from memory to disk storage, and update the node to the disk storage address; In response to a draft undo operation or redo operation triggered by a user, the sliding window is moved to obtain a corresponding node in the chain structure, so as to obtain a corresponding draft return according to a memory storage address recorded in the node.

2. The method according to claim 1, wherein: The method further comprises: According to the sliding window, nodes with recorded memory storage addresses in the chain structure outside the sliding window are subjected to disk persistence processing, and / or nodes of the link structure adjacent to the sliding window are subjected to disk recovery processing.

3. The method according to claim 2, wherein: The step of responding to the draft undo operation or redo operation triggered by the user, moving the sliding window, acquiring the corresponding node in the chain structure, and acquiring the corresponding draft return according to the memory storage address recorded by the node further includes: In response to a draft revocation operation triggered by a user, the sliding window is moved to a node previous to the current node, the backup pointer is moved to a node previous to the current node, a memory storage address recorded in the previous node is obtained, and a corresponding draft is obtained and returned; The step of performing disk persistence processing on the nodes with recorded memory storage addresses in the chain structure outside the sliding window according to the sliding window, and / or performing disk recovery processing on the nodes of the link structure adjacent to the sliding window further includes: After the draft cancellation operation, according to the preset length of the sliding window and the position of the backup pointer, the next node of the chain structure node located at the end of the sliding window is obtained; Determine whether the next node has recorded the memory storage address; If yes, transfer the corresponding draft in the next node from the memory to the disk storage, and update the record of the next node to the disk storage address; Obtain the node of the chain structure located at the initial end of the sliding window, obtain the disk storage address from the node, restore the draft from the disk to the memory storage, and update the record of the node to the memory storage address.

4. The method according to claim 2, wherein: The step of responding to the draft undo operation or redo operation triggered by the user, moving the sliding window, acquiring the corresponding node in the chain structure, and acquiring the corresponding draft return according to the memory storage address recorded by the node further includes: In response to the draft redo operation triggered by the user, the sliding window is moved to the node after the current node, the backup pointer is moved to the node after the current node, the memory storage address recorded in the node after the current node is obtained, and the corresponding draft is obtained and returned; The step of performing disk persistence processing on the nodes with recorded memory storage addresses in the chain structure outside the sliding window according to the sliding window, and / or performing disk recovery processing on the nodes of the link structure adjacent to the sliding window further includes: After the draft redo operation, according to the preset length of the sliding window and the position of the backup pointer, the previous node of the chain structure node located at the initial end of the sliding window is obtained, the corresponding draft in the previous node is transferred from the memory to the disk storage, and the record of the previous node is updated to the disk storage address; Acquire the node of the chain structure located at the end of the sliding window; Determine whether the node has recorded the disk storage address; If so, obtain the disk storage address from the node, restore the draft from the disk to the memory storage, and update the record of the node to the memory storage address.

5. The method according to any one of claims 1 to 4, wherein: Before responding to the draft undo operation or redo operation triggered by the user, the method further includes: Determine the current node of the chain structure according to the backup pointer, and judge whether the record of the previous node of the current node is empty; If not, an undo operation is displayed in the draft editing interface so that the user can trigger the undo operation.

6. The method according to any one of claims 1 to 4, wherein: Before responding to the draft undo operation or redo operation triggered by the user, the method further includes: Determine the current node of the chain structure according to the backup pointer, and judge whether the record of the next node after the current node is empty; If not, a redo operation is displayed in the draft editing interface for the user to trigger the redo operation.

7. The method according to any one of claims 1 to 6, wherein: After storing the draft in the memory, recording the memory storage address of the draft at the next node of the current node, and moving the sliding window to move the backup pointer to the next node of the current node, the method further includes: The current node of the chain structure is determined according to the backup pointer, and the records of each node after the current node are deleted.

8. The method according to any one of claims 1 to 7, wherein: After determining the current node of the chain structure according to the backup pointer in response to the draft backup operation triggered by the user, the method further includes: Determine whether a storage address is recorded in the current node; If not, storing the draft in the memory, and recording the memory storage address of the draft at the current node; If so, the draft is stored in the memory, and the memory storage address of the draft is recorded in the next node of the current node, and the sliding window is moved to move the backup pointer to the next node of the current node.

9. A cache draft backup device based on a sliding window, comprising: A node determination module, adapted to respond to a draft backup operation triggered by a user, and to determine a current node of the chain structure according to a backup pointer; The chain structure is stored in the memory and includes a sliding window of a preset length; The backup pointer points to the node of the latest version of the draft; A memory storage module, adapted to store the draft into a memory, record the memory storage address of the draft at a node next to the current node, and move the sliding window to move the backup pointer to a node next to the current node; The disk storage module is adapted to determine whether there is a node of the chain structure outside the sliding window, and the memory storage address is recorded in the node; if so, the corresponding draft in the node is transferred from the memory to the disk storage, and the node is updated to the disk storage address; The moving module is adapted to respond to a draft undo operation or redo operation triggered by a user, move the sliding window, obtain the corresponding node in the chain structure, and obtain the corresponding draft return according to the memory storage address recorded in the node.

10. A computing device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the cache draft backup method based on a sliding window as described in any one of claims 1-8.

11. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and wherein the executable instruction enables a processor to execute operations corresponding to the cache draft backup method based on a sliding window as described in any one of claims 1 to 8.

12. A computer program product, comprising at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the cache draft backup method based on a sliding window as described in any one of claims 1 to 8.