CN114281250A - Method and device for cleaning storage file, storage medium and electronic device - Google Patents

Method and device for cleaning storage file, storage medium and electronic device Download PDF

Info

Publication number
CN114281250A
CN114281250A CN202111459878.8A CN202111459878A CN114281250A CN 114281250 A CN114281250 A CN 114281250A CN 202111459878 A CN202111459878 A CN 202111459878A CN 114281250 A CN114281250 A CN 114281250A
Authority
CN
China
Prior art keywords
file
storage
preset
storage device
storage time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111459878.8A
Other languages
Chinese (zh)
Inventor
彭垚
王亚明
林亦宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Shanma Zhiqing Technology Co Ltd
Shanghai Supremind Intelligent Technology Co Ltd
Original Assignee
Hangzhou Shanma Zhiqing Technology Co Ltd
Shanghai Supremind Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Shanma Zhiqing Technology Co Ltd, Shanghai Supremind Intelligent Technology Co Ltd filed Critical Hangzhou Shanma Zhiqing Technology Co Ltd
Priority to CN202111459878.8A priority Critical patent/CN114281250A/en
Publication of CN114281250A publication Critical patent/CN114281250A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method and a device for cleaning a storage file, a storage medium and an electronic device, wherein the method comprises the following steps: determining a first preset storage time for storing the first file into the storage device according to the set file grade of the first file, wherein the file grade of the first file is used for indicating the importance degree of the first file; and clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage time length. By the method and the device, the problem of file cleaning in the related technology is solved, and the effects of improving the efficiency and accuracy of file cleaning are achieved.

Description

Method and device for cleaning storage file, storage medium and electronic device
Technical Field
The embodiment of the invention relates to the field of communication, in particular to a method and a device for cleaning a storage file, a storage medium and an electronic device.
Background
File storage is now heavily deployed in unstructured data storage in various systems, which masks the form of the specific storage medium and provides a highly scalable and data redundancy fault tolerant mechanism.
The storage space of a storage medium is not infinite. Once the storage space is used up, the service is not available, and the service of the upper layer user is greatly affected, so that the regular data cleaning is required. The traditional cleaning method is to delete the oldest data, and the mode often has the problems of untimely cleaning, low efficiency, incapability of preferentially deleting files which are no longer needed and the like.
Disclosure of Invention
The embodiment of the invention provides a method and a device for cleaning a stored file, a storage medium and an electronic device, which are used for at least solving the problem of cleaning the file in the related technology.
According to an embodiment of the invention, a method for cleaning a storage file is provided, which includes: determining a first preset storage time for storing a first file into a storage device according to a set file grade of the first file, wherein the file grade of the first file is used for indicating the importance degree of the first file; and clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage time length.
According to another embodiment of the present invention, there is provided a cleaning apparatus for a storage file, including: the device comprises a first determining module, a second determining module and a storage module, wherein the first determining module is used for determining a first preset storage time for storing a first file into a storage device according to a set file grade of the first file, and the file grade of the first file is used for indicating the importance degree of the first file; the first cleaning module is configured to clean the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration.
In an exemplary embodiment, the apparatus further includes: the device comprises a first setting module and a second setting module, wherein the first setting module is used for setting file information of a first file according to a preset format before determining a first preset storage time for the first file to be stored in a storage device according to a set file grade of the first file, and the file information comprises at least one of the following: the name of the container where the first file is located, the classification information of the first file, the initial time information of the first file stored in the storage device, and the file grade of the first file.
In an exemplary embodiment, the first determining module includes: a first setting unit, configured to set tag information of the first file according to a file level of the first file, where the tag information includes N pieces of preset storage duration information, each piece of preset storage duration information in the N pieces of preset storage duration information corresponds to a file level, and N is a natural number greater than or equal to 1; a first configuration unit, configured to configure the tag information into the first file to identify the first preset storage duration for storing the first file into the storage device.
In an exemplary embodiment, the first cleaning module includes: a first calculating unit, configured to calculate an expiration time of the first file in the storage device according to a current storage time of the first file in the storage device and the first preset storage duration; a first deleting unit configured to delete the storage of the first file in the storage device when the expiration storage time is less than or equal to the current storage time.
In an exemplary embodiment, the first cleaning module includes: a second calculating unit, configured to calculate, at the current storage time, a first current storage time period in which the first file is stored in the storage device according to start time information of the first file stored in the storage device and the first preset storage time period; and the second deleting unit is used for deleting the storage of the first file in the storage device under the condition that the first current storage time length is greater than or equal to the first preset storage time length.
In an exemplary embodiment, the apparatus further includes: a second determining module, configured to determine a second preset storage duration of a second file stored in the storage device after the first file is cleared from the storage device, where the second preset storage duration is shorter than the first preset storage duration, and the second preset storage duration corresponds to a file class of the second file; a first calculating module, configured to calculate, at the current storage time, a second current storage time period in which the second file is stored in the storage device according to the start time information of the second file stored in the storage device and the second preset storage time period; and the first deleting module is used for deleting the storage of the second file in the storage device under the condition that the second current storage time length is greater than or equal to the second preset storage time length.
In an exemplary embodiment, the apparatus further includes: a first detection module, configured to detect, based on a current storage time of the first file in the storage device and the first preset storage time, a second preset storage time of another file in the storage device according to a preset period when a storage space in the storage device is smaller than a preset storage space after the storage of the first file in the storage device is cleared; and the second deleting module is used for deleting the storage of the other files in the storage device under the condition that the second preset storage duration is shorter than the first preset storage duration.
In an exemplary embodiment, the apparatus further includes: a first prompting module, configured to send a prompting message when the storage space in the storage device is smaller than a preset storage space after the storage of the other files in the storage device is deleted when the second preset storage duration is smaller than the first preset storage duration, where the prompting message is used to prompt that the storage device is in an abnormal state.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, the first preset storage time for storing the first file into the storage device is determined according to the set file grade of the first file, wherein the file grade of the first file is used for representing the importance degree of the first file, and the storage of the first file in the storage device is cleaned based on the current storage time of the first file in the storage device and the first preset storage time. The purpose of cleaning the file based on the preset storage duration of the file is achieved; and the preset storage time of the file is set based on the importance degree of the file, so that the aim of cleaning the file based on the importance degree of the file is further fulfilled. Therefore, the problem of file cleaning in the related technology can be solved, and the effect of improving the efficiency and accuracy of file cleaning is achieved.
Drawings
Fig. 1 is a block diagram of a hardware structure of a mobile terminal of a method for cleaning a stored file according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for cleaning a stored file according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of cleaning a file according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of cleaning a file according to an embodiment of the present invention (two);
fig. 5 is a block diagram of a structure of a cleaning apparatus for a storage file according to an embodiment of the present invention.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking an example of the method running on a mobile terminal, fig. 1 is a block diagram of a hardware structure of the mobile terminal of the method for clearing a storage file according to the embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store a computer program, for example, a software program and a module of an application software, such as a computer program corresponding to the method for clearing a storage file in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In this embodiment, a method for cleaning a storage file is provided, and fig. 2 is a flowchart of a method for cleaning a storage file according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, determining a first preset storage time for storing the first file into the storage device according to the set file grade of the first file, wherein the file grade of the first file is used for representing the importance degree of the first file;
in the present embodiment, for example, the storage duration of a file that is relatively important is set to one year, the storage duration of a file that is less important is set to 3 months, the storage duration of a file that is not important is set to 1 month, and the like. After the cleaning condition of the storage device is set, cleaning is automatically triggered.
Step S204, based on the current storage time and the first preset storage duration of the first file in the storage device, the storage of the first file in the storage device is cleared.
In this embodiment, the cleaning of the first file includes deleting the first file.
The execution subject of the above steps may be a terminal, but is not limited thereto.
Through the steps, the first preset storage time for storing the first file into the storage device is determined according to the set file grade of the first file, wherein the file grade of the first file is used for representing the importance degree of the first file, and the storage of the first file in the storage device is cleaned based on the current storage time of the first file in the storage device and the first preset storage time. The purpose of cleaning the file based on the preset storage duration of the file is achieved; and the preset storage time of the file is set based on the importance degree of the file, so that the aim of cleaning the file based on the importance degree of the file is further fulfilled. Therefore, the problem of file cleaning in the related technology can be solved, and the effect of improving the efficiency and accuracy of file cleaning is achieved.
In an exemplary embodiment, before determining a first preset storage time for storing the first file into the storage device according to the set file rank of the first file, the method further includes:
s21, setting file information of the first file according to a preset format, wherein the file information comprises at least one of the following: the method comprises the steps of storing the first file in a storage device, storing the first file in the storage device, and storing the first file in the storage device.
In this embodiment, the preset format may include, for example: { bucket _ name }/{ resource _ name }/yyyyy/mmdd/hh/, wherein the bucket _ name is used for indicating the name of a file container bucket used for storage; resource _ name is used for representing the classification of a user on a storage file, such as a picture, a video and the like; yyyy is used to denote the year in 4 bits, such as 2021; mmdd is used to indicate the month of two digits and the date of two digits, such as 0321; hh is used to indicate the number of hours in the 24 hour system, e.g., 15.
In an exemplary embodiment, determining a first preset storage duration for storing the first file into the storage device according to the set file grade of the first file includes:
s31, setting label information of the first file according to the file grade of the first file, wherein the label information comprises N pieces of preset storage duration information, each piece of preset storage duration information in the N pieces of preset storage duration information corresponds to one file grade, and N is a natural number greater than or equal to 1;
s32, configuring the label information into the first file to identify a first preset storage duration of the first file stored in the storage device.
In this embodiment, for example, the N pieces of tag information include: short-term storage, storage for 7 days, mid-term, medium-term, storage for 30 days, long-term, storage for 365 days.
The storage duration of the file can be determined by configuring the file with Tag information, for example, Object Tag: term, long-term, is used to indicate that the file should be saved for at least 30 days. If a certain file is not provided with tag, the file is considered as a temporary file, the storage time is not guaranteed, and the file can be cleaned at any time.
In an exemplary embodiment, the clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration includes:
s41, calculating the deadline of the first file in the storage device according to the current storage time and the first preset storage duration of the first file in the storage device;
s42, in the case where the expiration storage time is less than or equal to the current storage time, deleting the storage of the first file in the storage device.
In this embodiment, for example, if today is 2021 year, 7 month and 10 days, and the longest storage time length long-term is 365 days, the longest storage date is 2020 year, 7 month and 10 days. And acquiring all the file lists to be deleted and deleting the files through the date prefixes in the label information keys in the files.
In an exemplary embodiment, the clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration includes:
s51, under the current storage time, calculating a first current storage time length of the first file stored in the storage device according to the initial time information of the first file stored in the storage device and a first preset storage time length;
and S52, deleting the storage of the first file in the storage device under the condition that the first current storage time length is greater than or equal to the first preset storage time length.
In an exemplary embodiment, after cleaning up the storage of the first file in the storage device, the method further comprises:
s61, determining a second preset storage time length of a second file stored in the storage device, wherein the second preset storage time length is less than the first preset storage time length, and the second preset storage time length corresponds to the file grade of the second file;
s62, under the current storage time, according to the initial time information of the second file stored in the storage device and a second preset storage time, calculating a second current storage time of the second file stored in the storage device;
and S63, deleting the storage of the second file in the storage device under the condition that the second current storage time length is greater than or equal to the second preset storage time length.
In this embodiment, for example, files that exceed short-term are cleaned. The last save date for short-term and mid-term is calculated. And traversing the files in the two saved dates through the date prefixes of the label information keys of the files, and clearing the files if the set life cycle is short-term. Considering that the files needing to be stored for a long time are few, and most of the files belong to the condition of short-term storage, the large number of files can be cleaned at the stage under a small traversal amount.
In an exemplary embodiment, after the clearing of the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration, the method further includes:
s71, detecting a second preset storage duration of other files in the storage device according to a preset period under the condition that the storage space in the storage device is smaller than the preset storage space;
and S72, deleting the storage of other files in the storage device under the condition that the second preset storage time length is less than the first preset storage time length.
In the present embodiment, for example, the storage duration of other files in the storage device is detected by day. Deleting all files configured as non-longest storage duration (long-term). It is then checked whether the storage space is below a threshold for space shortage and, if so, the cleaning step is stopped. If still below this value, the cleaning step is repeated.
In an exemplary embodiment, in the case that the second preset storage duration is less than the first preset storage duration, after deleting the storage of the other files in the storage device, the method further includes:
and S81, sending out prompt information under the condition that the storage space in the storage device is smaller than the preset storage space, wherein the prompt information is used for prompting that the storage device is in an abnormal state.
In this embodiment, the cleaning service periodically checks the remaining available space of the disk, if the available space is lower than a preset space shortage threshold, the above steps are executed, and if the space shortage is still left after the above steps are executed, the personnel can be notified to perform the intervention processing in a manner of alarming or the like.
The invention is illustrated below with reference to specific examples:
as shown in fig. 3, the process of cleaning up a file in this embodiment includes the following steps:
s301, calculating the longest storage date according to the current date and the storage time length configuration. Taking the example of 7, month and 10 days in 2021 today, the longest storage time long-term is 365 days, and the longest storage date is 10 days in 7 months in 2020. And acquiring all the file lists to be deleted and deleting the files through the date prefixes in the file keys.
S302, the files exceeding short-term are cleaned. The last save date for short-term and mid-term is calculated. And traversing the files in the two saved dates through the date prefixes of the file keys, and clearing the files if the set life cycle is short-term. Considering that the files needing to be stored for a long time are few, and most of the files belong to the condition of short-term storage, the large number of files can be cleaned at the stage under a small traversal amount.
S303, clearing the files exceeding mid-term. This step is similar to S302, and calculates the last date saved for mid-term and long-term, and cleans up mid-term files with life cycle in this range
And finishing the cleaning process at the last time. The cleaning effect can be timely and efficient by repeatedly executing the process after a proper time interval.
In this embodiment, the above steps may be performed individually or in combination.
In an exemplary embodiment, when the remaining space of the storage device is insufficient, to ensure that the service is available, a more aggressive cleaning strategy is adopted, as shown in fig. 4, which includes the following steps:
s401, calculating the longest storage date according to the current date and the storage time length configuration. And acquiring all the file lists to be deleted and deleting the files through the date prefixes in the file keys. This step coincides with S301 of file cleaning based on the life cycle setting.
And S402, checking the life cycle configuration of the files according to the day granularity from the last storage date obtained by the calculation of the S401 until the time for executing cleaning, and deleting all the files configured to be the non-longest storage duration (long-term). It is then checked whether the storage space is below a threshold for space shortage and, if so, the cleaning step is stopped. If the value is still lower than the predetermined value, S402 is repeatedly executed.
The cleaning service regularly checks the remaining available space of the disk, if the available space is lower than a preset space shortage threshold value, the steps are executed, and if the space shortage is still caused after the steps are executed, personnel can be informed to intervene in the treatment in a mode of alarming and the like.
In summary, the storage life cycle duration of different files can be flexibly set according to the embodiment, so that the files can be deleted according to a more reasonable strategy, more spaces can be cleaned under less traversal amount, and the cleaning efficiency and timeliness are improved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a device for cleaning a stored file is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, and the description of the device that has been already made is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a structure of a device for cleaning a storage file according to an embodiment of the present invention, as shown in fig. 5, the device includes:
a first determining module 52, configured to determine a first preset storage duration in which a first file is stored in a storage device according to a set file level of the first file, where the file level of the first file is used to indicate an importance degree of the first file;
a first cleaning module 54, configured to clean up storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration.
In an exemplary embodiment, the apparatus further includes:
the device comprises a first setting module and a second setting module, wherein the first setting module is used for setting file information of a first file according to a preset format before determining a first preset storage time for the first file to be stored in a storage device according to a set file grade of the first file, and the file information comprises at least one of the following: the name of the container where the first file is located, the classification information of the first file, the initial time information of the first file stored in the storage device, and the file grade of the first file.
In an exemplary embodiment, the first determining module includes:
a first setting unit, configured to set tag information of the first file according to a file level of the first file, where the tag information includes N pieces of preset storage duration information, each piece of preset storage duration information in the N pieces of preset storage duration information corresponds to a file level, and N is a natural number greater than or equal to 1;
a first configuration unit, configured to configure the tag information into the first file to identify the first preset storage duration for storing the first file into the storage device.
In an exemplary embodiment, the first cleaning module includes:
a first calculating unit, configured to calculate an expiration time of the first file in the storage device according to a current storage time of the first file in the storage device and the first preset storage duration;
a first deleting unit configured to delete the storage of the first file in the storage device when the expiration storage time is less than or equal to the current storage time.
In an exemplary embodiment, the first cleaning module includes:
a second calculating unit, configured to calculate, at the current storage time, a first current storage time period in which the first file is stored in the storage device according to start time information of the first file stored in the storage device and the first preset storage time period;
and the second deleting unit is used for deleting the storage of the first file in the storage device under the condition that the first current storage time length is greater than or equal to the first preset storage time length.
In an exemplary embodiment, the apparatus further includes:
a second determining module, configured to determine a second preset storage duration of a second file stored in the storage device after the first file is cleared from the storage device, where the second preset storage duration is shorter than the first preset storage duration, and the second preset storage duration corresponds to a file class of the second file;
a first calculating module, configured to calculate, at the current storage time, a second current storage time period in which the second file is stored in the storage device according to the start time information of the second file stored in the storage device and the second preset storage time period;
and the first deleting module is used for deleting the storage of the second file in the storage device under the condition that the second current storage time length is greater than or equal to the second preset storage time length.
In an exemplary embodiment, the apparatus further includes:
a first detection module, configured to detect, based on a current storage time of the first file in the storage device and the first preset storage time, a second preset storage time of another file in the storage device according to a preset period when a storage space in the storage device is smaller than a preset storage space after the storage of the first file in the storage device is cleared;
and the second deleting module is used for deleting the storage of the other files in the storage device under the condition that the second preset storage duration is shorter than the first preset storage duration.
In an exemplary embodiment, the apparatus further includes:
a first prompting module, configured to send a prompting message when the storage space in the storage device is smaller than a preset storage space after the storage of the other files in the storage device is deleted when the second preset storage duration is smaller than the first preset storage duration, where the prompting message is used to prompt that the storage device is in an abnormal state.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for executing the above steps.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
In an exemplary embodiment, the processor may be configured to execute the above steps by a computer program.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. A method for cleaning a stored file is characterized by comprising the following steps:
determining a first preset storage time for storing a first file into a storage device according to a set file grade of the first file, wherein the file grade of the first file is used for indicating the importance degree of the first file;
and clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage time length.
2. The method of claim 1, wherein before determining the first preset storage time for storing the first file in the storage device according to the set file rank of the first file, the method further comprises:
setting file information of the first file according to a preset format, wherein the file information comprises at least one of the following: the name of the container where the first file is located, the classification information of the first file, the starting time information of the first file stored in the storage device, and the file grade of the first file.
3. The method of claim 1, wherein determining the first preset storage time for the first file to be stored in the storage device according to the set file rank of the first file comprises:
setting label information of the first file according to the file grade of the first file, wherein the label information comprises N pieces of preset storage time length information, each piece of preset storage time length information in the N pieces of preset storage time length information corresponds to one file grade, and N is a natural number greater than or equal to 1;
and configuring the tag information into the first file to identify the first preset storage time length of the first file stored in the storage device.
4. The method of claim 1, wherein clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration comprises:
calculating the deadline storage time of the first file in the storage device according to the current storage time of the first file in the storage device and the first preset storage duration;
deleting the storage of the first file in the storage device if the expiration storage time is less than or equal to the current storage time.
5. The method of claim 1, wherein clearing the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration comprises:
under the current storage time, calculating a first current storage time length for storing the first file into the storage device according to the initial time information for storing the first file into the storage device and the first preset storage time length;
and deleting the storage of the first file in the storage equipment under the condition that the first current storage time length is greater than or equal to the first preset storage time length.
6. The method of claim 1, wherein after cleaning up storage of the first file in the storage device, the method further comprises:
determining a second preset storage time of a second file stored in the storage device, wherein the second preset storage time is shorter than the first preset storage time, and the second preset storage time corresponds to the file grade of the second file;
under the current storage time, calculating a second current storage time length for storing the second file into the storage device according to the starting time information for storing the second file into the storage device and the second preset storage time length;
and deleting the storage of the second file in the storage device under the condition that the second current storage time length is greater than or equal to the second preset storage time length.
7. The method according to any one of claims 1 to 6, wherein after the clearing of the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage time period, the method further comprises:
under the condition that the storage space in the storage device is smaller than a preset storage space, detecting second preset storage duration of other files in the storage device according to a preset period;
and deleting the storage of the other files in the storage equipment under the condition that the second preset storage duration is less than the first preset storage duration.
8. The method according to claim 7, wherein in a case where the second preset storage duration is less than the first preset storage duration, after deleting the storage of the other files in the storage device, the method further comprises:
and sending prompt information under the condition that the storage space in the storage equipment is smaller than a preset storage space, wherein the prompt information is used for prompting that the storage equipment is in an abnormal state.
9. A cleaning apparatus for a stored file, comprising:
the device comprises a first determining module, a second determining module and a storage module, wherein the first determining module is used for determining a first preset storage time for storing a first file into a storage device according to a set file grade of the first file, and the file grade of the first file is used for indicating the importance degree of the first file;
the first cleaning module is used for cleaning the storage of the first file in the storage device based on the current storage time of the first file in the storage device and the first preset storage duration.
10. A computer-readable storage medium, in which a computer program is stored, which computer program, when being executed by a processor, carries out the method of any one of claims 1 to 8.
11. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 8.
CN202111459878.8A 2021-12-01 2021-12-01 Method and device for cleaning storage file, storage medium and electronic device Pending CN114281250A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111459878.8A CN114281250A (en) 2021-12-01 2021-12-01 Method and device for cleaning storage file, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111459878.8A CN114281250A (en) 2021-12-01 2021-12-01 Method and device for cleaning storage file, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN114281250A true CN114281250A (en) 2022-04-05

Family

ID=80870776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111459878.8A Pending CN114281250A (en) 2021-12-01 2021-12-01 Method and device for cleaning storage file, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN114281250A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114791981A (en) * 2022-06-24 2022-07-26 山东欧通信息科技有限公司 Internet-based data query management system for file consultation

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424246A (en) * 2013-08-27 2015-03-18 鸿富锦精密工业(深圳)有限公司 Data storage system and method
US20170060886A1 (en) * 2015-08-31 2017-03-02 International Business Machines Corporation File deletion in storage devices based on the deletion priority rules
WO2017185616A1 (en) * 2016-04-25 2017-11-02 乐视控股(北京)有限公司 File storage method and electronic equipment
CN107766005A (en) * 2017-11-02 2018-03-06 深圳天珑无线科技有限公司 E-file processing method, device and electric terminal
CN110187836A (en) * 2019-05-29 2019-08-30 北京奇艺世纪科技有限公司 A kind of data-erasure method, device, computer and storage medium
CN111221790A (en) * 2019-10-25 2020-06-02 苏州浪潮智能科技有限公司 Log file processing method and device and computer readable storage medium
CN113535697A (en) * 2021-07-07 2021-10-22 广州三叠纪元智能科技有限公司 Climbing frame data cleaning method, climbing frame control device and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424246A (en) * 2013-08-27 2015-03-18 鸿富锦精密工业(深圳)有限公司 Data storage system and method
US20170060886A1 (en) * 2015-08-31 2017-03-02 International Business Machines Corporation File deletion in storage devices based on the deletion priority rules
WO2017185616A1 (en) * 2016-04-25 2017-11-02 乐视控股(北京)有限公司 File storage method and electronic equipment
CN107766005A (en) * 2017-11-02 2018-03-06 深圳天珑无线科技有限公司 E-file processing method, device and electric terminal
CN110187836A (en) * 2019-05-29 2019-08-30 北京奇艺世纪科技有限公司 A kind of data-erasure method, device, computer and storage medium
CN111221790A (en) * 2019-10-25 2020-06-02 苏州浪潮智能科技有限公司 Log file processing method and device and computer readable storage medium
CN113535697A (en) * 2021-07-07 2021-10-22 广州三叠纪元智能科技有限公司 Climbing frame data cleaning method, climbing frame control device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114791981A (en) * 2022-06-24 2022-07-26 山东欧通信息科技有限公司 Internet-based data query management system for file consultation

Similar Documents

Publication Publication Date Title
CN110661659B (en) Alarm method, device and system and electronic equipment
CN110213068B (en) Message middleware monitoring method and related equipment
CN108038130B (en) Automatic false user cleaning method, device, equipment and storage medium
CN107590016A (en) Power-down rebooting recognition methods and device
CN110806960A (en) Information processing method and device and terminal equipment
CN114281250A (en) Method and device for cleaning storage file, storage medium and electronic device
CN113472858B (en) Buried point data processing method and device and electronic equipment
CN113497721B (en) Network fault positioning method and device
CN110855484B (en) Method, system, electronic device and storage medium for automatically detecting traffic change
JP6015750B2 (en) Log collection server, log collection system, and log collection method
CN110955587A (en) Method and device for determining equipment to be replaced
CN114417200B (en) Network data acquisition method and device and electronic equipment
CN115878052A (en) RAID array inspection method, inspection device and electronic equipment
CN107995014B (en) Method and device for discovering function topology based on alarm information
CN110333968B (en) Data management method and device applied to database and computer equipment
WO2023111392A1 (en) Method and system for modifying state of device using detected anomalous behavior
CN112016025B (en) Data acquisition method and device and terminal equipment
CN112637002B (en) Test resource deleting method and device, storage medium and electronic equipment
CN111274219B (en) Data storage method and device, storage medium and electronic device
CN113486237A (en) Flight information recommendation method and system, storage medium and electronic equipment
CN115705259A (en) Fault processing method, related device and storage medium
CN112052147A (en) Monitoring method, electronic device and storage medium
CN110543470A (en) Message early warning method and device, storage medium and electronic device
CN113676347B (en) Load prediction method and device of server, storage medium and electronic device
CN114339850B (en) Base station data transmission method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination