Cache file processing method and apparatus, device, and storage medium
By prioritizing the flushing of larger cache files based on their size during cache file processing, the problem of resource waste caused by user modifications after cache files are flushed is solved, thus improving the processing efficiency of cache files.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2023-10-16
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, user modifications to cached files after they are flushed to storage units lead to resource waste and low cached file processing efficiency.
Get the write time of the first cache file to be flushed in the message queue. If the time difference is greater than the preset duration, select a preset number of target cache files from the message queue, determine the flushing order according to the file size from largest to smallest, and add them to the sub-message queue for flushing.
By prioritizing the flushing of larger cache files, the probability of user modifications is reduced, thus improving the processing efficiency of cache files.
Smart Images

Figure CN117389471B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device and storage medium for processing cached files. Background Technology
[0002] Currently, distributed storage systems are being used more and more widely. A distributed storage system consists of a cache and storage units. The cache has a relatively small storage space, and to ensure that the cache can receive files correctly, the cached files need to be flushed to the storage units.
[0003] In existing technologies, firstly, the write times of multiple cache files are determined; then, based on the write times of the cache files, the priority for flushing the cache files is determined; finally, the cache files in the cache are flushed to the storage unit in descending order of flushing priority. The earlier the write time of a cache file, the higher its flushing priority.
[0004] However, the inventors discovered that the existing technology has at least the following technical problems: For each cache file, the user can modify the cache file at any time. If the flush priority is determined by the write time of the cache file, if the user modifies the cache file after it has been flushed to the storage unit, the resources used for this flush will be wasted, resulting in low cache file processing efficiency. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for processing cached files, which can improve the efficiency of cached file processing.
[0006] Firstly, this application provides a method for processing cached files, including:
[0007] Obtain the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time;
[0008] If the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration, then a preset number of target cache files are selected from the multiple cache files included in the message queue.
[0009] Based on the file size of each target cache file, the order in which the preset number of target cache files are flushed is determined in descending order of file size;
[0010] According to the specified flushing order, the preset number of target cache files are added to the sub-message queue, and each target cache file is flushed to the storage unit according to the sorting of each target cache file in the sub-message queue.
[0011] In one possible design, determining the flushing order of the preset number of target cache files based on the file size of each target cache file, in descending order of file size, includes: for each target cache file, if the file size of the target cache file is greater than a preset value, then the target cache file is placed in a first group; if the file size of the target cache file is not greater than the preset value, then the target cache file is placed in a second group; wherein the flushing order of the first group takes precedence over the flushing order of the second group; sorting the multiple target cache files in the first group in descending order of file size, and sorting the multiple target cache files in the second group in descending order of file size, to obtain the flushing order of the preset number of target cache files.
[0012] In one possible design, the preset value is the file size of the first cache file to be flushed.
[0013] In one possible design, the method further includes: for multiple target cache files of the same size, obtaining the write time corresponding to each of the multiple target cache files; and determining the flushing order of the multiple target cache files according to the order of the write times.
[0014] In one possible design, selecting a preset number of target cache files from the plurality of cache files included in the message queue includes: selecting a preset number of target cache files from front to back according to the order of the plurality of cache files in the message queue.
[0015] In one possible design, the method further includes: in response to any target cache file being modified, removing the target cache file from the sub-message queue.
[0016] In one possible design, the method further includes: if the time difference between the current time and the write time of the first cache file to be flushed is less than or equal to the preset duration, then the cache files are flushed to the storage unit from front to back according to the order of the multiple cache files in the message queue.
[0017] Secondly, this application provides a cached file processing apparatus, comprising:
[0018] The acquisition module is used to acquire the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time;
[0019] The selection module is used to select a preset number of target cache files from the multiple cache files included in the message queue if the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration.
[0020] The determination module is used to determine the flushing order of the preset number of target cache files based on the file size of each target cache file, in descending order of file size;
[0021] The flushing module is used to add the preset number of target cache files to the sub-message queue according to the flushing order, and flush each target cache file to the storage unit according to the sorting of each target cache file in the sub-message queue.
[0022] Thirdly, this application provides an electronic device, including: a processor and a memory;
[0023] The memory stores computer-executed instructions;
[0024] The processor executes computer execution instructions stored in the memory, causing the processor to perform the cache file processing method as described in the first aspect and various possible designs of the first aspect.
[0025] Fourthly, this application provides a computer storage medium storing computer execution instructions, which, when executed by a processor, implement the cache file processing method described in the first aspect and various possible designs of the first aspect.
[0026] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the cache file processing method described in the first aspect and various possible designs of the first aspect.
[0027] The cache file processing method, apparatus, device, and storage medium provided in this application obtain the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time; if the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration, a preset number of target cache files are selected from the multiple cache files included in the message queue; based on the file size of each target cache file, the flushing order of the preset number of target cache files is determined in descending order of file size; according to the flushing order, the preset number of target cache files are added to a sub-message queue, and each target cache file is flushed to the storage unit according to the sorting of each target cache file in the sub-message queue. In the embodiments of this application, since the flushing of cache files is slow, a small queue is selected from the large message queue, and the cache files in the small queue are sorted according to the size of the cache files in the queue, with priority given to flushing larger cache files. Since the probability of users modifying larger cache files is low, the effectiveness of flushing can be ensured, thereby improving the processing efficiency of cache files. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a schematic diagram illustrating an application scenario of the cache file processing method provided in the embodiments of this application;
[0030] Figure 2 The cache file processing method flow provided in the embodiments of this application Figure 1 ;
[0031] Figure 3 A schematic diagram of the cache file processing method provided in the embodiments of this application. Figure 1 ;
[0032] Figure 4 The cache file processing method flow provided in the embodiments of this application Figure 2 ;
[0033] Figure 5 Schematic diagram of the structure of the cache file processing device provided in the embodiments of this application Figure 1 ;
[0034] Figure 6 Hardware structure diagram of the electronic device provided in the embodiments of this application Figure 1 . Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0036] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0037] Currently, distributed storage systems are being used more and more widely. A distributed storage system consists of a cache and storage units. The cache has a relatively small storage space, and to ensure that the cache can receive files correctly, the cached files need to be flushed to the storage units.
[0038] In existing technology, firstly, the write times of multiple cache files are determined; then, the flushing priority of the cache files is determined based on their write times; finally, the cache files in the cache are flushed to the storage unit in descending order of flushing priority. The earlier the write time of a cache file, the higher its flushing priority. However, users can modify each cache file at any time. If the flushing priority is determined by the write time, after the cache file has been flushed to the storage unit, if the user modifies the cache file, the modified cache file needs to be flushed again. This wastes the resources used for this flushing, resulting in low cache file processing efficiency.
[0039] Therefore, how to avoid repeated flushing of cached files in order to improve the efficiency of cached file processing is a technical problem that urgently needs to be solved.
[0040] To address the aforementioned technical problems, this application proposes the following technical concept: First, the write time of the first cache file to be flushed in the message queue is obtained; if the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration, a preset number of target cache files are selected from the multiple cache files included in the message queue; then, based on the file size of each target cache file, the flushing order of the preset number of target cache files is determined in descending order of file size; finally, according to the flushing order, the preset number of target cache files are added to a sub-message queue, and each target cache file is flushed to the storage unit according to the sorting of each target cache file in the sub-message queue. That is, when the flushing of cache files is slow, a small queue is selected from the large message queue, and the cache files in the small queue are sorted according to the size of the cache files in the queue, prioritizing the flushing of larger cache files. Larger cache files are less likely to be modified by users, ensuring the effectiveness of the flushing and thus improving the processing efficiency of cache files.
[0041] Figure 1 This is a schematic diagram illustrating an application scenario of the cache file processing method provided in this application embodiment. For example... Figure 1As shown, this cache file processing method can be applied to a cache file processing system, which includes a cache 101 and a storage unit 102. The cache 101 has a relatively small storage space, which can be used to store cache files. To ensure that the cache 101 has sufficient storage space to receive files normally, the cache files in the cache 101 need to be flushed to the storage unit 102. In this case, the cache file processing method of this application can be used to flush the cache files in the cache 101 to the storage unit 102. The cache file processing method proposed in this application will be described in detail below through detailed embodiments.
[0042] Figure 2 The cache file processing method flow provided in the embodiments of this application Figure 1 The cache file processing method in this application embodiment can be applied to a cache file processing system. For example... Figure 2 As shown, the method includes:
[0043] S201. Obtain the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time.
[0044] In this embodiment of the disclosure, the message queue includes multiple cache files to be flushed. These cache files can be ordered according to their write time. For example, if cache file A was written at 10:50:00 and cache file B was written at 10:50:10, then cache file A is ordered before cache file B.
[0045] S202. If the time difference between the current time and the write time of the first cache file to be flushed is greater than the preset duration, then select a preset number of target cache files from the multiple cache files included in the message queue.
[0046] Optionally, a preset number of target cache files can be selected from multiple cache files included in the message queue, including: selecting a preset number of target cache files from front to back according to the sorting of the multiple cache files in the message queue.
[0047] In this embodiment of the disclosure, the specific values of the preset duration and the preset quantity are not specifically limited. Optionally, the preset duration is 10 seconds and the preset quantity is 10.
[0048] It should be noted that when there is no congestion during the flushing process, all cache files can be flushed directly. The specific steps are as follows: if the time difference between the current time and the write time of the first cache file to be flushed is less than or equal to the preset duration, then the cache files are flushed to the storage unit from the beginning according to their order in the message queue.
[0049] S203. Based on the file size of each target cache file, determine the order in which the preset number of target cache files are flushed, in descending order of file size.
[0050] Optionally, such as Figure 3 As shown, multiple target cache files are sorted in descending order of file size to obtain the flushing order of a preset number of target cache files. For example, the multiple target cache files include f1, f2, f3, f4, f5, f6, f7, and f8; the file size of each target cache file is f1 (5M), f2 (2M), f3 (1M), f4 (4M), f5 (3M), f6 (5M), f7 (9M), and f8 (7M); the flushing order of the preset number of target cache files is determined by descending order of file size as follows: f7 (9M) → f8 (7M) → f6 (5M) → f1 (5M) → f4 (4M) → f5 (3M) → f2 (2M) → f3 (1M).
[0051] S204. Following the brushing order, add a preset number of target cache files to the sub-message queue, and brush each target cache file to the storage unit according to the sorting of each target cache file in the sub-message queue.
[0052] In this embodiment of the disclosure, the storage unit may be a storage cluster or a single storage device. Optionally, as... Figure 3 As shown, this step is as follows: add a preset number of target cache files to the sub-message queue, add the target cache files from the sorted sub-message queue to the flush thread in sequence, and flush the target cache files to the storage unit through the flush thread.
[0053] It should be noted that during the refresh process, if a user modifies a cache file, that cache file will be removed from the sub-message queue. Specifically, the steps are as follows: in response to any modification to a target cache file, the target cache file is removed from the sub-message queue.
[0054] The cache file processing method provided in this application obtains the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time; if the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration, a preset number of target cache files are selected from the multiple cache files included in the message queue; based on the file size of each target cache file, the flushing order of the preset number of target cache files is determined in descending order of file size; according to the flushing order, the preset number of target cache files are added to a sub-message queue, and each target cache file is flushed to the storage unit according to the sorting of each target cache file in the sub-message queue. In the embodiments of this application, since the flushing of cache files is slow, a small queue is selected from the large message queue, and the cache files in the small queue are sorted according to the size of the cache files in the queue, with priority given to flushing larger cache files. Since the probability of users modifying larger cache files is low, the effectiveness of flushing can be ensured, thereby improving the processing efficiency of cache files.
[0055] Figure 4 The cache file processing method flow provided in the embodiments of this application Figure 2 .exist Figure 2 Based on this, the specific method for determining the flushing order of a preset number of target cache files in step S203, according to the file size of each target cache file and in descending order of file size, is explained in detail; for example Figure 4 As shown; the method includes:
[0056] S401. For each target cache file, if the file size of the target cache file is greater than a preset value, the target cache file is placed in the first group; if the file size of the target cache file is not greater than the preset value, the target cache file is placed in the second group; wherein, the flushing order of the first group takes precedence over the flushing order of the second group.
[0057] For example, multiple target cache files include f1, f2, f3, f4, f5, f6, f7, and f8; the file size of each target cache file is f1 (5M), f2 (2M), f3 (1M), f4 (4M), f5 (3M), f6 (5M), f7 (9M), and f8 (7M).
[0058] The default value is the file size of the first cache file to be downloaded, i.e., f1 (5M). If the file size of the target cache file is greater than the default value, the target cache file is placed in the first group {f6 (6M), f7 (9M), f8 (7M)}. If the file size of the target cache file is not greater than the default value, the target cache file is placed in the second group: {f1 (5M), f2 (2M), f3 (1M), f4 (4M), f5 (3M)}.
[0059] S402. Sort the multiple target cache files in the first group in descending order of file size, and sort the multiple target cache files in the second group in descending order of file size to obtain the flush order of a preset number of target cache files.
[0060] For example, the first group is: {f6(6M), f7(9M), f8(7M)}; the multiple target cache files in the first group are sorted in descending order of file size as {f7(9M), f8(7M), f6(6M)}. The second group is: {f1(5M), f2(2M), f3(1M), f4(4M), f5(3M)}; the multiple target cache files in the second group are sorted in descending order of file size as {f1(5M), f4(4M), f5(3M), f2(2M), f3(1M)}.
[0061] The first group is flushed in a specific order before the second group, and the flushing order of the target cache files with the preset number of cache files is: f7(9M)→f8(7M)→f6(5M)→f1(5M)→f4(4M)→f5(3M)→f2(2M)→f3(1M).
[0062] It should be noted that for multiple target cache files of the same size, the write time of each target cache file is obtained; the flushing order of the multiple target cache files is determined according to the order of the write times.
[0063] For example, the second group is: {f1(5M, t1), f2(4M, t2), f3(3M, t3), f4(4M, t4), f5(4M, t5)}; where the file sizes of f2(4M, t2), f4(4M, t4), and f5(4M, t5) are the same, then the flushing order of multiple target cache files is determined according to the order of their write times as: f2(4M, t2) → f4(4M, t4) → f5(4M, t5). The order of their write times is: t1, t2, t3, t4, t5.
[0064] Here, by sorting in a split recursive manner, multiple target cache files are divided into two groups, and then the files in each group are sorted separately. This reduces the number of direct size comparisons between target cache files, thereby improving sorting efficiency.
[0065] Figure 5 Schematic diagram of the structure of the cache file processing device provided in the embodiments of this application Figure 1The device includes: an acquisition module 501, a selection module 502, a determination module 503, and a brush module 504;
[0066] The acquisition module 501 is used to acquire the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time.
[0067] The selection module 502 is used to select a preset number of target cache files from the multiple cache files included in the message queue if the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration.
[0068] The determining module 503 is used to determine the flushing order of the preset number of target cache files according to the file size of each target cache file, in descending order of file size;
[0069] The flush module 504 is used to add the preset number of target cache files to the sub-message queue according to the flush order, and flush each target cache file to the storage unit according to the sorting of each target cache file in the sub-message queue.
[0070] In one possible design, the determining module 503 determines the flushing order of the preset number of target cache files based on the file size of each target cache file, in descending order of file size. Specifically, this includes: for each target cache file, if the file size of the target cache file is greater than a preset value, then the target cache file is placed in a first group; if the file size of the target cache file is not greater than the preset value, then the target cache file is placed in a second group; wherein the flushing order of the first group takes precedence over the flushing order of the second group; sorting the multiple target cache files in the first group in descending order of file size, and sorting the multiple target cache files in the second group in descending order of file size, to obtain the flushing order of the preset number of target cache files.
[0071] In one possible design, the preset value is the file size of the first cache file to be flushed.
[0072] In one possible design, the determining module 503 is further configured to, for multiple target cache files of the same size, obtain the write time corresponding to each of the multiple target cache files; and determine the flushing order of the multiple target cache files according to the order of the write times.
[0073] In one possible design, the selection module 502 selects a preset number of target cache files from the plurality of cache files included in the message queue, specifically including: selecting a preset number of target cache files from front to back according to the order of the plurality of cache files in the message queue.
[0074] In one possible design, the apparatus further includes a deletion module; the deletion module is configured to delete the target cache file from the sub-message queue in response to any target cache file being modified.
[0075] In one possible design, the flush module 504 is further configured to flush each cache file to the storage unit from front to back according to the order of the multiple cache files in the message queue if the time difference between the current time and the write time of the first cache file to be flushed is less than or equal to the preset duration.
[0076] The apparatus provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.
[0077] Figure 6 Hardware structure diagram of the electronic device provided in the embodiments of this application Figure 1 .like Figure 6 As shown, the electronic device of this embodiment includes: a processor 601 and a memory 602; wherein
[0078] Memory 602 is used to store instructions executed by the computer;
[0079] The processor 601 is used to execute computer execution instructions stored in the memory to implement the various steps performed by the electronic device in the above embodiments. For details, please refer to the relevant descriptions in the foregoing method embodiments.
[0080] Alternatively, the memory 602 can be either standalone or integrated with the processor 601.
[0081] When the memory 602 is set up independently, the electronic device also includes a bus 603 for connecting the memory 602 and the processor 601.
[0082] This application also provides a computer storage medium storing computer execution instructions. When the processor executes the computer execution instructions, it implements the cache file processing method of the above-described method embodiments.
[0083] This application also provides a computer program product, including a computer program, which, when executed by a processor, implements the cache file processing method of the above-described method embodiments.
[0084] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.
[0085] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.
[0086] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.
[0087] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute partial steps of the methods in the various embodiments of this application.
[0088] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0089] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.
[0090] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0091] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.
[0092] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. Both the processor and the storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic device or host device.
[0093] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for processing cached files, characterized in that, include: Obtain the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time; If the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration, then a preset number of target cache files are selected from the multiple cache files included in the message queue. For each target cache file, if the file size of the target cache file is greater than a preset value, the target cache file is placed in the first group; if the file size of the target cache file is not greater than the preset value, the target cache file is placed in the second group; wherein, the flushing order of the first group takes precedence over the flushing order of the second group. The multiple target cache files in the first group are sorted in descending order of file size, and the multiple target cache files in the second group are sorted in descending order of file size to obtain the flushing order of the preset number of target cache files; wherein, the preset value is the file size of the first cache file to be flushed; According to the brushing order, the preset number of target cache files are added to the sub-message queue, and each target cache file is brushed to the storage unit according to the sorting of each target cache file in the sub-message queue. If the time difference between the current time and the write time of the first cache file to be flushed is less than or equal to the preset duration, then each cache file is flushed to the storage unit from front to back according to the order of the multiple cache files in the message queue. In response to any target cache file being modified, the target cache file is removed from the sub-message queue.
2. The method according to claim 1, characterized in that, Also includes: For multiple target cache files of the same size, obtain the write time of each target cache file; The order in which the multiple target cache files are flushed is determined according to the order of their write times.
3. The method according to claim 1, characterized in that, The step of selecting a preset number of target cache files from the multiple cache files included in the message queue includes: Based on the sorting of the multiple cache files in the message queue, a preset number of target cache files are selected from front to back.
4. A cache file processing device, characterized in that, include: The acquisition module is used to acquire the write time of the first cache file to be flushed in the message queue, wherein the message queue includes multiple cache files sorted by write time; The selection module is used to select a preset number of target cache files from the multiple cache files included in the message queue if the time difference between the current time and the write time of the first cache file to be flushed is greater than a preset duration. A determination module is used to, for each target cache file, if the file size of the target cache file is greater than a preset value, place the target cache file into a first group; if the file size of the target cache file is not greater than the preset value, place the target cache file into a second group; wherein, the flushing order of the first group takes precedence over the flushing order of the second group; sorting multiple target cache files in the first group in descending order of file size, and sorting multiple target cache files in the second group in descending order of file size, to obtain the flushing order of the preset number of target cache files; wherein, the preset value is the file size of the first cache file to be flushed; The flushing module is used to add the preset number of target cache files to the sub-message queue according to the flushing order, and flush each target cache file to the storage unit according to the sorting of each target cache file in the sub-message queue. The down-flush module is also used to flush each cache file to the storage unit from front to back according to the order of the multiple cache files in the message queue if the time difference between the current time and the write time of the first cache file to be flushed is less than or equal to the preset duration. A deletion module is used to delete the target cache file from the sub-message queue in response to any target cache file being modified.
5. An electronic device, characterized in that, include: Processor and memory; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the cache file processing method as described in any one of claims 1 to 3.
6. A computer storage medium, characterized in that, The computer storage medium stores computer execution instructions, and when the processor executes the computer execution instructions, it implements the cache file processing method as described in any one of claims 1 to 3.