CN112181630A - Data storage method, data storage equipment and computer readable storage medium - Google Patents

Data storage method, data storage equipment and computer readable storage medium Download PDF

Info

Publication number
CN112181630A
CN112181630A CN201910606330.8A CN201910606330A CN112181630A CN 112181630 A CN112181630 A CN 112181630A CN 201910606330 A CN201910606330 A CN 201910606330A CN 112181630 A CN112181630 A CN 112181630A
Authority
CN
China
Prior art keywords
data
stored
space
storage
storage device
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
CN201910606330.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.)
Watrix Technology Beijing Co Ltd
Original Assignee
Watrix Technology Beijing 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 Watrix Technology Beijing Co Ltd filed Critical Watrix Technology Beijing Co Ltd
Priority to CN201910606330.8A priority Critical patent/CN112181630A/en
Publication of CN112181630A publication Critical patent/CN112181630A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data storage method, data storage equipment and a computer-readable storage medium. The method comprises the following steps: when data to be stored are stored, detecting the proportion of unused space in a storage device to storage space; when the proportion of the unused space in the storage space is smaller than a preset proportion threshold, determining the available space of the storage device according to the data volume of the data to be stored; storing the data to be stored to the occupiable space. When the space of the storage device is insufficient, if the data to be stored is to be stored, the occupied space in the storage device is determined according to the data quantity of the data to be stored, and then the data to be stored is stored at the position of the occupied space. The invention can realize the intelligent storage of the data without deleting the data manually, and can ensure that the data to be stored can be stored into the storage device all the time.

Description

Data storage method, data storage equipment and computer readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data storage method, device, and computer-readable storage medium.
Background
In the prior art, the utilization rate of the memory is high. For example: in data processing, a memory is usually used to store data generated during data processing. For another example: before watching the video, the user can download the video into the memory and watch the video. However, the capacity of the memory is limited, and when the memory is already full of data, or when the available space of the memory is insufficient to store new data, the new data cannot be stored in the memory. At present, when the memory is insufficient, the data that can be deleted in the memory usually needs to be manually cleared so as to release the memory space, or the memory can be expanded so as to increase the available space of the memory. However, this processing method for dealing with the memory shortage is time-consuming, labor-consuming and not intelligent enough.
Disclosure of Invention
The invention mainly aims to provide a data storage method, data storage equipment and a computer readable storage medium, which aim to solve the problem that the processing mode for dealing with memory shortage in the prior art is not intelligent enough.
Aiming at the technical problems, the invention solves the technical problems by the following technical scheme:
the invention discloses a data storage method, which comprises the following steps: when data to be stored are stored, detecting the proportion of unused space in a storage device to storage space; when the proportion of the unused space in the storage space is smaller than a preset proportion threshold, determining the available space of the storage device according to the data volume of the data to be stored; storing the data to be stored to the occupiable space.
Wherein the occupiable space comprises: a storage space occupied by data stored earliest to the storage device; and/or a storage space occupied by data stored in the storage device within a first preset time period.
Wherein the storing the data to be stored to the occupiable space comprises: using the data to be stored to cover the data stored in the occupiable space; or, the data stored in the occupiable space is firstly cached to a preset caching device, and then the data to be stored is stored in the occupiable space.
Wherein the storing the data to be stored to the occupiable space comprises: judging whether to use the data to be stored to cover the data stored in the occupiable space according to the selected data covering option; if so, using the data to be stored to cover the data stored in the occupied space; if not, after a preset second time period, the data to be stored is transferred to the storage device for storage.
Wherein, the transferring the data to be stored to the storage device for storage includes: detecting the proportion of the unused space in the storage device to the storage space; if the proportion of the unused space in the storage space is greater than or equal to the proportion threshold value, storing the data to be stored in the storage device; if the proportion of the unused space occupying the storage space is smaller than the proportion threshold value, caching the data stored in the occupied space to a preset caching device, and then storing the data to be stored to the occupied space.
Wherein, still include: after the data stored in the occupied space is cached in the caching device, if the caching time of the data reaches a preset time length, the data is cleared in the caching device.
After detecting the proportion of the unused space in the storage device to the storage space, the method further comprises the following steps: and if the proportion of the unused space in the storage space is greater than or equal to a preset proportion threshold value, storing the data to be stored in the storage device.
Wherein, the determining the occupiable space of the storage device according to the data volume of the data to be stored comprises: the data amount which can be stored in the occupied space is equal to the data amount of the data to be stored.
The invention also provides a data storage device, which comprises a processor and a memory; the processor is used for executing the data storage program stored in the memory so as to realize the data storage method.
The present invention further provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement the above-described data storage method.
The invention has the following beneficial effects:
when the space of the storage device is insufficient, if the data to be stored is to be stored, the occupied space in the storage device is determined according to the data quantity of the data to be stored, and then the data to be stored is stored at the position of the occupied space. The invention can realize the intelligent storage of the data without deleting the data manually, and can ensure that the data to be stored can be stored into the storage device all the time.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a data storage method according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a data storage method according to a second embodiment of the present invention;
FIG. 3 is a flowchart of a data transfer step according to a second embodiment of the present invention;
fig. 4 is a structural diagram of a data storage device according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
Example one
According to an embodiment of the present invention, a data storage method is provided. Fig. 1 is a flow chart of a data storage method according to a first embodiment of the invention.
Step S110, when storing the data to be stored, detecting the proportion of the unused space in the storage device to the storage space.
Unused space, i.e. unused storage space.
The proportion of the unused space in the storage space is unused space/storage space.
Step S120, when the proportion of the unused space in the storage space is smaller than a preset proportion threshold, determining the available space of the storage device according to the data volume of the data to be stored.
And the proportion threshold is used for measuring whether the storage device has enough space to store data. The ratio threshold may be an empirical value or an experimentally obtained value.
The occupiable space refers to a space in the storage space of the storage device, which can be used for storing the data to be stored. In other words, occupiable space refers to storage space that may be occupied by new data.
The occupiable space may be a portion of the storage space where no data is stored, or a portion of the storage space where data is stored plus a portion of the storage space where no data is stored.
Step S130, storing the data to be stored in the occupiable space.
In this embodiment, the amount of data that can be stored in the occupiable space is equal to the amount of data to be stored.
In this embodiment, the available space is a space where no data is stored or a space where data is already stored. Data that has been stored is data that can be deleted or migrated.
Further, the occupiable space comprises: a storage space occupied by data stored earliest to the storage device; and/or a storage space occupied by data stored in the storage device within a first preset time period. The first preset time period may be a few days per month, a few hours per day. For example: the movie is downloaded on the first day of each month and the first time period may be set to the first day of each month.
When the occupiable space stores data, storing the data to be stored to the occupiable space, including: using the data to be stored to cover the data stored in the occupiable space; or, the data stored in the occupiable space is firstly cached to a preset caching device, and then the data to be stored is stored in the occupiable space. For example: the user downloads a new video, and the new video data can be made to overwrite the data stored in the occupiable space, or the video stored in the occupiable space before is moved out to the cache device, and the new video is stored in the moved-out position.
In this embodiment, when the space of the storage device is insufficient, if the data is to be stored, the available space in the storage device is determined according to the data amount of the data to be stored, and then the data to be stored is stored in the available space. According to the embodiment, the data can be intelligently stored without manually deleting the data, and the data to be stored can be stored into the storage device all the time.
Example two
A more specific example is given below to further describe the present invention.
Fig. 2 is a flowchart of a data storage method according to a second embodiment of the present invention.
Step S210, when storing the data to be stored, detecting the proportion of the unused space in the storage device to the storage space.
Step S220, judging whether the proportion of the unused space in the storage space is smaller than a preset proportion threshold value; if yes, go to step S230; if not, step S270 is executed.
The proportion of the unused space occupying the storage space is smaller than the proportion threshold value, which can indicate that the unoccupied storage space is insufficient, and the situation that the data cannot be stored in the storage space occurs at any time.
For example: the threshold value of the ratio is 20%. The unused space of the storage device is detected, the proportion of the unused space to the storage space is determined, and when the proportion is less than 20%, the determination of the available space in the storage space is started.
Step S230, if the ratio of the unused space to the storage space is smaller than a preset ratio threshold, determining an available space of the storage device according to the data size of the data to be stored.
In this embodiment, the amount of data that can be stored in the occupiable space is equal to the amount of data to be stored.
An occupiable space comprising: a storage space occupied by data stored earliest to the storage device; and/or a storage space occupied by data stored in the storage device within a first preset time period.
Step S240, judging whether to use the data to be stored to cover the data stored in the occupiable space according to the selected data covering option; if yes, go to step S250; if not, step S260 is performed.
A data overlay selection for prompting a user whether to overlay data stored in the occupiable space.
A data overlay selection comprising: an override option and an override-not option. If the override option is selected, perform step S250; if the not-override option is selected, step S260 is performed.
And step S250, covering the data stored in the occupied space by using the data to be stored.
Step S260, after a second time period is preset, the data to be stored is transferred to the storage device for storage.
Step S270, if the proportion of the unused space in the storage space is greater than or equal to a preset proportion threshold value, storing the data to be stored in the storage device.
Further, the data to be stored is stored in the unused space of the storage device. And the data amount which can be stored in the unused space is larger than that of the data to be stored.
As shown in fig. 3, after a second time period is preset, the method for transferring the data to be stored to the storage device for storage includes the following steps:
in step S310, the ratio of the unused space in the storage device to the storage space is detected.
Step S320, judging whether the proportion of the unused space in the storage space is smaller than a proportion threshold value; if yes, go to step S330; if not, step S340 is performed.
And after the second time period is preset, determining the proportion of the unused space in the storage space again, wherein the purpose of determining whether the unused space is sufficient after the second time period is achieved.
Step S330, if the proportion of the unused space in the storage space is smaller than the proportion threshold, firstly caching the data stored in the occupiable space to a preset caching device, and then storing the data to be stored in the occupiable space.
Step S340, if the ratio of the unused space to the storage space is greater than or equal to the ratio threshold, storing the data to be stored in the storage device.
In this embodiment, after the data stored in the available space is cached in the caching device, if the caching time of the data reaches a preset time length, the data is cleared in the caching device.
EXAMPLE III
The present embodiments provide a data storage device. Fig. 4 is a block diagram of a data storage device according to a third embodiment of the present invention.
In this embodiment, the data storage device includes, but is not limited to: a processor 410, a memory 420.
The processor 410 is configured to execute the data storage program stored in the memory 420 to implement the data storage method according to the above-described embodiment.
Specifically, the processor 410 is configured to execute a data storage program stored in the memory 420 to implement the following steps: when data to be stored are stored, detecting the proportion of unused space in a storage device to storage space; when the proportion of the unused space in the storage space is smaller than a preset proportion threshold, determining the available space of the storage device according to the data volume of the data to be stored; storing the data to be stored to the occupiable space.
Wherein the occupiable space comprises: a storage space occupied by data stored earliest to the storage device; and/or a storage space occupied by data stored in the storage device within a first preset time period.
Wherein the storing the data to be stored to the occupiable space comprises: using the data to be stored to cover the data stored in the occupiable space; or, the data stored in the occupiable space is firstly cached to a preset caching device, and then the data to be stored is stored in the occupiable space.
Wherein the storing the data to be stored to the occupiable space comprises: judging whether to use the data to be stored to cover the data stored in the occupiable space according to the selected data covering option; if so, using the data to be stored to cover the data stored in the occupied space; if not, after a preset second time period, the data to be stored is transferred to the storage device for storage.
Wherein, the transferring the data to be stored to the storage device for storage includes: detecting the proportion of the unused space in the storage device to the storage space; if the proportion of the unused space in the storage space is greater than or equal to the proportion threshold value, storing the data to be stored in the storage device; if the proportion of the unused space occupying the storage space is smaller than the proportion threshold value, caching the data stored in the occupied space to a preset caching device, and then storing the data to be stored to the occupied space.
Wherein, still include: after the data stored in the occupied space is cached in the caching device, if the caching time of the data reaches a preset time length, the data is cleared in the caching device.
After detecting the proportion of the unused space in the storage device to the storage space, the method further comprises the following steps: and if the proportion of the unused space in the storage space is greater than or equal to a preset proportion threshold value, storing the data to be stored in the storage device.
Wherein, the determining the occupiable space of the storage device according to the data volume of the data to be stored comprises: the data amount which can be stored in the occupied space is equal to the data amount of the data to be stored.
Example four
The embodiment of the invention also provides a computer readable storage medium. The computer-readable storage medium herein stores one or more programs. Among other things, computer-readable storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When one or more programs in the computer-readable storage medium are executable by one or more processors to implement the data storage methods described above.
Specifically, the processor is configured to execute a data storage program stored in the memory to implement the steps of: when data to be stored are stored, detecting the proportion of unused space in a storage device to storage space; when the proportion of the unused space in the storage space is smaller than a preset proportion threshold, determining the available space of the storage device according to the data volume of the data to be stored; storing the data to be stored to the occupiable space.
Wherein the occupiable space comprises: a storage space occupied by data stored earliest to the storage device; and/or a storage space occupied by data stored in the storage device within a first preset time period.
Wherein the storing the data to be stored to the occupiable space comprises: using the data to be stored to cover the data stored in the occupiable space; or, the data stored in the occupiable space is firstly cached to a preset caching device, and then the data to be stored is stored in the occupiable space.
Wherein the storing the data to be stored to the occupiable space comprises: judging whether to use the data to be stored to cover the data stored in the occupiable space according to the selected data covering option; if so, using the data to be stored to cover the data stored in the occupied space; if not, after a preset second time period, the data to be stored is transferred to the storage device for storage.
Wherein, the transferring the data to be stored to the storage device for storage includes: detecting the proportion of the unused space in the storage device to the storage space; if the proportion of the unused space in the storage space is greater than or equal to the proportion threshold value, storing the data to be stored in the storage device; if the proportion of the unused space occupying the storage space is smaller than the proportion threshold value, caching the data stored in the occupied space to a preset caching device, and then storing the data to be stored to the occupied space.
Wherein, still include: after the data stored in the occupied space is cached in the caching device, if the caching time of the data reaches a preset time length, the data is cleared in the caching device.
After detecting the proportion of the unused space in the storage device to the storage space, the method further comprises the following steps: and if the proportion of the unused space in the storage space is greater than or equal to a preset proportion threshold value, storing the data to be stored in the storage device.
Wherein, the determining the occupiable space of the storage device according to the data volume of the data to be stored comprises: the data amount which can be stored in the occupied space is equal to the data amount of the data to be stored.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (10)

1. A method of storing data, comprising:
when data to be stored are stored, detecting the proportion of unused space in a storage device to storage space;
when the proportion of the unused space in the storage space is smaller than a preset proportion threshold, determining the available space of the storage device according to the data volume of the data to be stored;
storing the data to be stored to the occupiable space.
2. The method of claim 1, wherein the occupiable space comprises:
a storage space occupied by data stored earliest to the storage device; and/or the presence of a gas in the gas,
and storing the storage space occupied by the data stored in the storage device in a first preset time period.
3. The method of claim 1, wherein storing the data to be stored to the occupiable space comprises:
using the data to be stored to cover the data stored in the occupiable space; or,
caching the data stored in the occupied space to a preset caching device, and then storing the data to be stored to the occupied space.
4. The method of claim 1, wherein storing the data to be stored to the occupiable space comprises:
judging whether to use the data to be stored to cover the data stored in the occupiable space according to the selected data covering option;
if so, using the data to be stored to cover the data stored in the occupied space;
if not, after a preset second time period, the data to be stored is transferred to the storage device for storage.
5. The method of claim 4, wherein the moving the data to be stored to the storage device for storage comprises:
detecting the proportion of the unused space in the storage device to the storage space;
if the proportion of the unused space in the storage space is greater than or equal to the proportion threshold value, storing the data to be stored in the storage device;
if the proportion of the unused space occupying the storage space is smaller than the proportion threshold value, caching the data stored in the occupied space to a preset caching device, and then storing the data to be stored to the occupied space.
6. The method of claim 3 or 5, further comprising:
after the data stored in the occupied space is cached in the caching device, if the caching time of the data reaches a preset time length, the data is cleared in the caching device.
7. The method of claim 1, after detecting a proportion of unused space in the storage device to storage space, further comprising:
and if the proportion of the unused space in the storage space is greater than or equal to a preset proportion threshold value, storing the data to be stored in the storage device.
8. The method according to any one of claims 1 to 7, wherein the determining the occupiable space of the storage device according to the data volume of the data to be stored comprises:
the data amount which can be stored in the occupied space is equal to the data amount of the data to be stored.
9. A data storage device, wherein the data storage device comprises a processor, a memory; the processor is used for executing the data storage program stored in the memory to realize the data storage method of any one of claims 1-8.
10. A computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the data storage method of any one of claims 1 to 8.
CN201910606330.8A 2019-07-05 2019-07-05 Data storage method, data storage equipment and computer readable storage medium Pending CN112181630A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910606330.8A CN112181630A (en) 2019-07-05 2019-07-05 Data storage method, data storage equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910606330.8A CN112181630A (en) 2019-07-05 2019-07-05 Data storage method, data storage equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN112181630A true CN112181630A (en) 2021-01-05

Family

ID=73918734

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910606330.8A Pending CN112181630A (en) 2019-07-05 2019-07-05 Data storage method, data storage equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112181630A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761306A (en) * 2014-01-22 2014-04-30 深圳市欧珀通信软件有限公司 Smart terminal file cleaning method and device
CN104424109A (en) * 2013-09-09 2015-03-18 联想(北京)有限公司 Information processing method and electronic equipment
CN105023319A (en) * 2015-08-06 2015-11-04 南车株洲电力机车有限公司 Brake data storage method and system
CN106445414A (en) * 2016-09-20 2017-02-22 广州视源电子科技股份有限公司 Method and system for expanding available storage space of terminal equipment
CN107193886A (en) * 2017-04-27 2017-09-22 北京小米移动软件有限公司 File memory method and device
WO2017185616A1 (en) * 2016-04-25 2017-11-02 乐视控股(北京)有限公司 File storage method and electronic equipment
WO2018006587A1 (en) * 2016-07-07 2018-01-11 中兴通讯股份有限公司 File storage method, terminal, and storage medium
WO2018090703A1 (en) * 2016-11-15 2018-05-24 杭州海康威视数字技术股份有限公司 Data storage and deletion method and apparatus

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424109A (en) * 2013-09-09 2015-03-18 联想(北京)有限公司 Information processing method and electronic equipment
CN103761306A (en) * 2014-01-22 2014-04-30 深圳市欧珀通信软件有限公司 Smart terminal file cleaning method and device
CN105023319A (en) * 2015-08-06 2015-11-04 南车株洲电力机车有限公司 Brake data storage method and system
WO2017185616A1 (en) * 2016-04-25 2017-11-02 乐视控股(北京)有限公司 File storage method and electronic equipment
WO2018006587A1 (en) * 2016-07-07 2018-01-11 中兴通讯股份有限公司 File storage method, terminal, and storage medium
CN106445414A (en) * 2016-09-20 2017-02-22 广州视源电子科技股份有限公司 Method and system for expanding available storage space of terminal equipment
WO2018090703A1 (en) * 2016-11-15 2018-05-24 杭州海康威视数字技术股份有限公司 Data storage and deletion method and apparatus
CN107193886A (en) * 2017-04-27 2017-09-22 北京小米移动软件有限公司 File memory method and device

Similar Documents

Publication Publication Date Title
US10133679B2 (en) Read cache management method and apparatus based on solid state drive
CN107643880B (en) File data migration method and device based on distributed file system
CN103761306B (en) A kind of intelligent terminal file clean-up method and device
CN104808952B (en) data cache method and device
FR3023030B1 (en) INVALIDATION DATA AREA FOR CACHE
US8412905B2 (en) Storage system having secondary data store to mirror data
KR20150104617A (en) Method, device and terminal equipment for cleaning up memory
CN108647151A (en) It is a kind of to dodge system metadata rule method, apparatus, equipment and storage medium entirely
CN109614377A (en) File delet method, device, equipment and the storage medium of distributed file system
CN106331148A (en) Cache management method and cache management device for data reading by clients
CN110990302B (en) Data caching method and device, electronic equipment and storage medium
TW201636845A (en) Memory device and operating method of same
US10310766B2 (en) Memory system and data relocating method
CN110427158B (en) Writing method of solid state disk and solid state disk
CN103246696A (en) High-concurrency database access method and method applied to multi-server system
US20170046099A1 (en) Storing metadata
US20120173594A1 (en) System and Method for Managing Discardable Objects
US20150324357A1 (en) Blended storage allocation on a storage agent
KR20170052441A (en) Centralized distributed systems and methods for managing operations
CN109213450B (en) Associated metadata deleting method, device and equipment based on flash memory array
JP3683814B2 (en) Reusing deleted application memory
CN106960054A (en) The access method and device of data file
CN104917788A (en) Data storage method and apparatus
US10073851B2 (en) Fast new file creation cache
CN112181630A (en) Data storage method, data storage equipment and computer readable storage medium

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