CN117742586A - Data storage method, device, computer equipment and storage medium - Google Patents

Data storage method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117742586A
CN117742586A CN202311594674.4A CN202311594674A CN117742586A CN 117742586 A CN117742586 A CN 117742586A CN 202311594674 A CN202311594674 A CN 202311594674A CN 117742586 A CN117742586 A CN 117742586A
Authority
CN
China
Prior art keywords
data
target
candidate
storage
block
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
CN202311594674.4A
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.)
China Telecom Technology Innovation Center
China Telecom Corp Ltd
Original Assignee
China Telecom Technology Innovation Center
China Telecom Corp 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 China Telecom Technology Innovation Center, China Telecom Corp Ltd filed Critical China Telecom Technology Innovation Center
Priority to CN202311594674.4A priority Critical patent/CN117742586A/en
Publication of CN117742586A publication Critical patent/CN117742586A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The application relates to a data storage method, a data storage device, a computer device and a storage medium. The method comprises the following steps: acquiring target data to be written into a user identification card; selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks; and writing the target data into the target storage block. The method and the device avoid the situation that the same storage block is frequently read and written when the user identification card writes the target data of the same type for multiple times, and further avoid the situation that the service life of the user identification card is reduced and even the user identification card is damaged.

Description

Data storage method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data storage method, apparatus, computer device, and storage medium.
Background
With the continuous development of communication technology, terminal devices have become an important tool in daily life, work and study of users. The terminal device can bring great help to users, and a user identification card (Subscriber Identity Module, SIM) in the terminal device plays a role of importance.
However, in the operation process of the subscriber identity module card, as the number of data reading and writing increases, the performance and the service life of the subscriber identity module card are reduced. Therefore, how to extend the service life of the subscriber identity card becomes a critical issue.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a data storage method, apparatus, computer device, and storage medium capable of extending the service life of a subscriber identity card.
In a first aspect, the present application provides a data storage method. The method comprises the following steps:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
In one embodiment, the usage status of the candidate memory block includes: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
In one embodiment, selecting the target memory block from the candidate memory blocks according to the number of times of data reading and writing of the candidate memory blocks in the user identification card and the use state of the candidate memory blocks includes:
according to the use state of the candidate storage blocks, the candidate storage blocks with the use state of idle states in the user identification card are used as standby storage blocks;
and selecting a target storage block with the minimum data reading and writing times from the standby storage blocks according to the data reading and writing times of the candidate storage blocks.
In one embodiment, selecting the target memory block with the minimum data read-write times from the standby memory blocks according to the data read-write times of the candidate memory blocks includes:
based on the bubbling function, sorting the standby storage blocks according to the data read-write times of the candidate storage blocks;
and selecting a target storage block with the least data reading and writing times from the sorted standby storage blocks.
In one embodiment, after writing the target data into the target memory block, the method further comprises:
performing integrity verification on target data written into a target storage block;
and if the integrity verification is not passed, the target data is re-written into the target storage block.
In one embodiment, after writing the target data into the target memory block, the method further comprises:
and updating the data read-write times and the use state corresponding to the target storage block.
In a second aspect, the present application also provides a data storage device. The device comprises:
the acquisition module is used for acquiring target data to be written into the user identification card;
the selection module is used for selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and the first writing module is used for writing the target data into the target storage block.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
In a fourth aspect, the present application also provides a computer-readable storage medium. A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
In a fifth aspect, the present application also provides a computer program product. Computer program product comprising a computer program which, when executed by a processor, realizes the steps of:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
According to the data storage method, the data storage device, the computer equipment and the storage medium, the target storage block is determined from the candidate storage block according to the data reading and writing times of the candidate storage block and the use state of the candidate storage block, and then the target data to be written into the user identification card is written into the target storage block. According to the above-mentioned in-process can know, this application can be according to the data read-write number of times of candidate storage block and the service condition of candidate storage block, select the target storage block from candidate storage block, compare in prior art, only according to the data type of target data, store this target data in the storage block of corresponding data type, this application has avoided when user identification card write into the target data of same type many times appear the condition that frequently read-write appears in same storage block, and then, avoid causing the life reduction of user identification card even the condition that user identification card damaged.
Drawings
Fig. 1 is an application environment diagram of a data storage method according to an embodiment of the present application;
FIG. 2 is a flowchart of a data storage method according to an embodiment of the present application;
FIG. 3 is a flowchart of determining a target storage block according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of another data storage method according to an embodiment of the present application;
FIG. 5 is a flowchart of yet another data storage method according to an embodiment of the present application;
FIG. 6 is a block diagram of a first data storage device according to an embodiment of the present application;
FIG. 7 is a block diagram of a second data storage device according to an embodiment of the present application;
FIG. 8 is a block diagram of a third data storage device according to an embodiment of the present application;
FIG. 9 is a block diagram of a fourth data storage device according to an embodiment of the present application;
fig. 10 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application. In the description of the present application, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Based on the above situation, the data storage method provided in the embodiment of the present application may be applied to an application environment as shown in fig. 1. In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in FIG. 1. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing acquired data of the data storage method. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a data storage method.
The application discloses a data storage method, a data storage device, computer equipment and a storage medium, which specifically can comprise the following contents: according to the data read-write times of the candidate storage blocks and the use states of the candidate storage blocks, the target storage blocks are determined from the candidate storage blocks, and then target data to be written into the user identification card are written into the target storage blocks.
In one embodiment, as shown in fig. 2, fig. 2 is a flowchart of a data storage method provided in an embodiment of the present application, where a data storage method performed by a computer device in fig. 1 may include the following steps:
step 201, obtaining target data to be written into a subscriber identity module card.
It should be noted that, the target data refers to data to be written into the subscriber identity card, and the data types of the target data may include, but are not limited to: authentication key data, user identity data, terminal communication data, application data, file object data, and the like.
Further, when the target data to be written into the user identification card needs to be obtained, determining the data type of the candidate data, further judging whether the data of the candidate data belongs to the data type of the target data, and if so, taking the candidate data as the target data to be written into the user identification card; if the candidate data does not belong to the user identification card, determining that the candidate data is not the target data to be written into the user identification card.
Step 202, selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks.
Wherein the target memory block refers to a candidate memory block for storing target data.
The use states of the candidate storage blocks include: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
It should be noted that, in order to prevent the same memory block from performing data read-write operations repeatedly and continuously, thereby affecting the service life of the user identification card, the target memory block can be selected from the candidate memory blocks according to the data read-write times of the candidate memory blocks in the user identification card and the use state of the candidate memory blocks, so as to ensure the balance of the data read times of each candidate data block and achieve the purpose of prolonging the service life of the user identification card.
Further, the target storage block can be determined from the candidate storage blocks only according to the data read-write times of the candidate storage blocks; specifically, when the target storage block needs to be determined, the candidate storage block with the minimum data read-write times is selected as the target storage block according to the data read-write times of the candidate storage block, so that the phenomenon that a certain candidate storage block performs read-write operation for many times is prevented, and the service life of the user identification card is influenced.
And if the data read-write times of at least two candidate storage blocks are the same and are the minimum values, randomly selecting one candidate storage block from the at least two candidate storage blocks as a target storage block.
Further illustratively, the target memory block may be determined from the candidate memory blocks based solely on the use status of the candidate memory blocks; specifically, when the target memory block needs to be determined, a candidate memory block whose use state is an idle state is selected as the target memory block for storing the target data according to the use state of the candidate memory block. Therefore, the occurrence of a certain candidate storage block is prevented from simultaneously writing a plurality of data, and the service life of the user identification card is reduced.
And if the use state of at least two candidate storage blocks is the idle state, randomly selecting one candidate storage block from the at least two candidate storage blocks as a target storage block.
Further, to further ensure the service life of the subscriber identity module card, the target memory block for storing the target data may be determined from the candidate memory blocks according to the number of times of data reading and writing of the candidate memory block and the use state of the candidate memory block. Specifically, the candidate storage block with the idle use state and the least data reading and writing times is selected as the target storage block for storing the target data, so that the balance of the data reading times of each candidate data block is ensured, and the purpose of prolonging the service life of the user identification card is achieved.
In one embodiment of the present application, when the target storage block needs to be determined from the candidate storage blocks, a spare storage block whose usage state is an idle state may be selected from the candidate storage blocks according to the usage state of the candidate storage blocks, and the target storage block with the minimum data read-write number may be determined from the spare storage blocks according to the data read-write number of the candidate storage blocks.
Further, if the usage states of the candidate memory blocks are all occupied states, the occupied time length of each candidate memory block entering the occupied state is obtained, N candidate memory blocks with the longest occupied time length are used as standby memory blocks, and further, a target memory block with the minimum data read-write times is determined from the standby memory blocks according to the data read-write times of the candidate memory blocks. Wherein, N is a positive integer greater than or equal to 1, the value of N can be set and adjusted according to the historical experience and actual condition of staff, and the value range of N is not limited.
In an embodiment of the present application, when a target storage block needs to be selected from candidate storage blocks, a value of N may be preset to be 3, if the use states of the candidate storage blocks at the current moment are all occupied states, an occupied time of the candidate storage blocks is obtained, 3 candidate storage blocks with the longest occupied time are used as spare storage blocks, and further, according to the data read-write times of the candidate storage blocks, a target storage block with the minimum data read-write times is determined from the spare storage blocks.
Step 203, the target data is written into the target storage block.
It should be noted that, the information address book is stored in the user identification card, and the number of times of data reading and writing of the candidate storage block and the usage state of the candidate storage block are recorded in the information address book, so after the target data is written into the target storage block, the number of times of data reading and writing of the candidate storage block and the usage state of the candidate storage block in the information address book can be updated, so that the content recorded in the information address book accords with the actual situation of the candidate data block.
Further, the information address book may further record a data identifier written in the candidate storage block, so as to ensure that a user can determine a storage location of the data (i.e. the candidate storage block in which the positioning data is written) according to the content recorded in the information address book.
According to the data storage method, according to the data reading and writing times of the candidate storage blocks and the use state of the candidate storage blocks, the target storage blocks are determined from the candidate storage blocks, and then target data to be written into the user identification card are written into the target storage blocks. According to the above-mentioned in-process can know, this application can be according to the data read-write number of times of candidate storage block and the service condition of candidate storage block, select the target storage block from candidate storage block, compare in prior art, only according to the data type of target data, store this target data in the storage block of corresponding data type, this application has avoided when user identification card write into the target data of same type many times appear the condition that frequently read-write appears in same storage block, and then, avoid causing the life reduction of user identification card even the condition that user identification card damaged.
In one embodiment, the performance and the service life of the subscriber identity card are reduced as the number of data read/write operations is increased. To prevent the above problem, the service life and performance of the subscriber identity module card may be reduced, as shown in fig. 3, by selecting a target memory block from the candidate memory blocks according to the number of times of data reading and writing of the candidate memory blocks in the subscriber identity module card and the use status of the candidate memory blocks, which may specifically include the following:
step 301, according to the use state of the candidate memory block, the candidate memory block with the use state of idle state in the user identification card is used as the spare memory block.
If the user identification card stores the information address book, the information address book records the number of times of data reading and writing of the candidate storage blocks and the use state of the candidate storage blocks, so when the standby storage block needs to be determined, the candidate storage block in the idle state can be determined according to the use state of the candidate storage block recorded in the information address book, and the candidate storage block in the idle state is the standby storage block.
In one embodiment of the present application, if three candidate memory blocks are included, the three candidate memory blocks are candidate memory block a, candidate memory block B and candidate memory block C, respectively, and the usage states of candidate memory block B and candidate memory block C are idle as known from the information address book stored in the user identification card, so candidate memory block B and candidate memory block C are used as spare memory blocks.
Further, if the user identification card type does not store the information address book, or the use state of the candidate storage block cannot be obtained according to the information address book, when the standby storage block needs to be determined, the expected storage occupation duration can be determined according to the working experience of a worker; and determining whether the time difference between the last data writing start time and the current time of each candidate storage block is larger than the expected occupied time of storage, if so, taking the candidate storage block as a standby storage block, and if not, determining that the candidate storage block is not the standby storage block.
In one embodiment of the present application, if three candidate memory blocks are included, the three candidate memory blocks are candidate memory block a, candidate memory block b, and candidate memory block c, respectively; according to working experience of staff, determining that the expected storage occupation time is 1s, determining a time difference value between the last data writing start time and the current time of each candidate storage block, wherein the time difference value corresponding to the candidate storage block a is 0.5s, the time difference value corresponding to the candidate storage block B is 1.5s, and the time difference value corresponding to the candidate storage block C is 2s, so that the time difference value between the candidate storage block B and the candidate storage block C is larger than the expected storage occupation time, and taking the candidate storage block B and the candidate storage block C as standby storage blocks.
Step 302, selecting a target storage block with the least data read-write times from the standby storage blocks according to the data read-write times of the candidate storage blocks.
When the target storage block needs to be determined, the spare storage block may be sorted according to the number of data read/write times of the candidate storage block, and the target storage block with the minimum number of data read/write times may be selected from the sorted spare storage blocks.
Among these, there are many methods for sorting spare memory blocks, for example: bubbling function ordering, selection ordering, insertion ordering, hill ordering, merging ordering, etc.
In one embodiment of the present application, when it is required to select a target memory block with the least number of data read/write operations from the spare memory blocks, the following may be included: based on the bubbling function, sorting the standby storage blocks according to the data read-write times of the candidate storage blocks; and selecting a target storage block with the least data reading and writing times from the sorted standby storage blocks.
According to the data storage method, the standby storage block is determined through the use state of the candidate storage block, and the target storage block is determined from the standby storage block according to the data read-write times of the candidate storage block, so that the situation that the same storage block is frequently read-written when the user identification card writes the target data of the same type for many times is avoided.
In one embodiment, as shown in fig. 4, after the target data is written into the target storage block, the following may be further included:
in step 401, integrity verification is performed on target data written into a target storage block.
It should be noted that, when the integrity verification needs to be performed on the target data in the target storage block, the following may be specifically included: before writing target data into a target storage block, calculating a first characteristic value corresponding to the target data which is not written into the target storage block based on a verification algorithm; after the target data is written into the target storage block, calculating a second characteristic value corresponding to the target data written into the target storage block by adopting a verification algorithm; if the first characteristic value is the same as the second characteristic value, determining that the integrity verification of the target data written into the target storage block is passed; if the first characteristic value and the second characteristic value are different, determining that the integrity verification of the target data written into the target storage block is not passed.
The verification algorithm may be a hash algorithm for integrity verification, such as MD5 (Message Digest Algorithm ) algorithm, MD4 algorithm, or the like.
If the integrity verification is not passed, the target data is re-written to the target memory block, step 402.
If the integrity verification is not passed, it means that there is a special case in the process of writing the target data into the target storage block, and therefore, in order to ensure that the target data is stored in the target storage block, it is necessary to repeatedly write the target data into the target storage block.
Special cases, among others, that cause the target data to be subject to data loss may include, but are not limited to: the target data is damaged due to the wrong storage operation, the target data is lost and thinned in the process of writing into the target storage block due to network faults, the target data is attacked by viruses in the process of writing into the target storage block, the target data is lost, and the like.
Further, if the integrity verification is passed, the number of times of data reading and writing and the use state corresponding to the target storage block can be updated. Specifically, if the user identification card stores an information address book, and the information address book records the data read-write times of the candidate storage block and the use state of the candidate storage block; therefore, when the integrity verification is passed, the data read-write times and the use state corresponding to the target storage block in the information address book are updated.
In one embodiment of the present application, when the target data a is written into the target storage block a, and the integrity of the target data a is verified, one is added to the number of times of data reading and writing of the target storage block a in the information address book, and the usage state corresponding to the target storage block in the information address book is updated to be the occupied state. When the target storage block A completes the writing operation to the target data A, the use state corresponding to the target storage block in the information address book is updated to be an idle state.
According to the data storage method, the integrity of the target data written into the target storage block is guaranteed through the integrity verification of the target data written into the target storage block, and the condition that incomplete target data are stored into the target storage block is prevented.
In one embodiment, as shown in fig. 5, when the target data needs to be written into the target storage block, the following may be specifically included:
step 501, obtaining target data to be written into a subscriber identity module card.
Step 502, according to the use state of the candidate storage block, the candidate storage block with the use state of the user identification card being in the idle state is used as the standby storage block.
Step 503, based on the bubbling function, ordering the spare memory blocks according to the number of data read/write times of the candidate memory blocks.
Step 504, selecting a target memory block with the least data read-write times from the sorted standby memory blocks.
Step 505, the target data is written into the target memory block.
Step 506, performing integrity verification on the target data written in the target storage block.
If the integrity verification is not passed, step 507, the target data is re-written into the target storage block.
And step 508, updating the data read-write times and the use state corresponding to the target storage block.
According to the data storage method, according to the data reading and writing times of the candidate storage blocks and the use state of the candidate storage blocks, the target storage blocks are determined from the candidate storage blocks, and then target data to be written into the user identification card are written into the target storage blocks. According to the above-mentioned in-process can know, this application can be according to the data read-write number of times of candidate storage block and the service condition of candidate storage block, select the target storage block from candidate storage block, compare in prior art, only according to the data type of target data, store this target data in the storage block of corresponding data type, this application has avoided when user identification card write into the target data of same type many times appear the condition that frequently read-write appears in same storage block, and then, avoid causing the life reduction of user identification card even the condition that user identification card damaged.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiments of the present application also provide a data storage device for implementing the above-mentioned data storage method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the data storage device provided below may be referred to above as limitation of the data storage method, and will not be repeated here.
In one embodiment, as shown in FIG. 6, there is provided a data storage device comprising: an acquisition module 10, a selection module 20 and a first writing module 30, wherein:
the acquiring module 10 is configured to acquire target data to be written into the subscriber identity module.
The selection module 20 is configured to select a target storage block from the candidate storage blocks according to the number of times of data reading and writing of the candidate storage blocks in the user identification card and the usage status of the candidate storage blocks.
The use states of the candidate storage blocks include: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
A first writing module 30 for writing target data into the target memory block.
According to the data storage device, according to the data reading and writing times of the candidate storage blocks and the use state of the candidate storage blocks, the target storage blocks are determined from the candidate storage blocks, and then target data to be written into the user identification card are written into the target storage blocks. According to the above-mentioned in-process can know, this application can be according to the data read-write number of times of candidate storage block and the service condition of candidate storage block, select the target storage block from candidate storage block, compare in prior art, only according to the data type of target data, store this target data in the storage block of corresponding data type, this application has avoided when user identification card write into the target data of same type many times appear the condition that frequently read-write appears in same storage block, and then, avoid causing the life reduction of user identification card even the condition that user identification card damaged.
In one embodiment, as shown in FIG. 7, there is provided a data storage device in which the selection module 20 includes: a first determination unit 21 and a second determination unit 22, wherein:
the first determining unit 21 is configured to use, as the spare memory block, a candidate memory block whose use state is an idle state in the subscriber identity module according to the use state of the candidate memory block.
The second determining unit 22 is configured to select, from the spare memory blocks, a target memory block with the smallest number of data reads and writes according to the number of data reads and writes of the candidate memory block.
In one embodiment, as shown in fig. 8, there is provided a data storage device in which the second determining unit 22 includes: a sorting subunit 221 and a selecting subunit 222, wherein:
the sorting subunit 221 is configured to sort the spare memory blocks according to the number of times of data reading and writing of the candidate memory blocks based on the bubbling function.
The selecting subunit 222 is configured to select a target storage block with the smallest number of data reading and writing times from the sorted spare storage blocks.
In one embodiment, as shown in FIG. 9, there is provided a data storage device further comprising: a verification module 40 and a second write module 50, wherein:
a verification module 40, configured to perform integrity verification on the target data written in the target storage block;
the second writing module 50 is configured to re-write the target data into the target storage block if the integrity verification is not passed.
The second writing module can also be used for updating the data reading and writing times and the use state corresponding to the target storage block.
The various modules in the data storage device described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 10. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a data storage method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 10 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
In one embodiment, the processor when executing the computer program further performs the steps of:
the use states of the candidate memory blocks include: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
In one embodiment, the processor when executing the computer program further performs the steps of:
according to the use state of the candidate storage blocks, the candidate storage blocks with the use state of idle states in the user identification card are used as standby storage blocks;
and selecting a target storage block with the minimum data reading and writing times from the standby storage blocks according to the data reading and writing times of the candidate storage blocks.
In one embodiment, the processor when executing the computer program further performs the steps of:
based on the bubbling function, sorting the standby storage blocks according to the data read-write times of the candidate storage blocks;
and selecting a target storage block with the least data reading and writing times from the sorted standby storage blocks.
In one embodiment, the processor when executing the computer program further performs the steps of:
performing integrity verification on target data written into a target storage block;
and if the integrity verification is not passed, the target data is re-written into the target storage block.
In one embodiment, the processor when executing the computer program further performs the steps of:
and updating the data read-write times and the use state corresponding to the target storage block.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the use states of the candidate memory blocks include: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
according to the use state of the candidate storage blocks, the candidate storage blocks with the use state of idle states in the user identification card are used as standby storage blocks;
and selecting a target storage block with the minimum data reading and writing times from the standby storage blocks according to the data reading and writing times of the candidate storage blocks.
In one embodiment, the computer program when executed by the processor further performs the steps of:
based on the bubbling function, sorting the standby storage blocks according to the data read-write times of the candidate storage blocks;
and selecting a target storage block with the least data reading and writing times from the sorted standby storage blocks.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing integrity verification on target data written into a target storage block;
and if the integrity verification is not passed, the target data is re-written into the target storage block.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and updating the data read-write times and the use state corresponding to the target storage block.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the use states of the candidate memory blocks include: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
In one embodiment, the computer program when executed by the processor further performs the steps of:
according to the use state of the candidate storage blocks, the candidate storage blocks with the use state of idle states in the user identification card are used as standby storage blocks;
and selecting a target storage block with the minimum data reading and writing times from the standby storage blocks according to the data reading and writing times of the candidate storage blocks.
In one embodiment, the computer program when executed by the processor further performs the steps of:
based on the bubbling function, sorting the standby storage blocks according to the data read-write times of the candidate storage blocks;
and selecting a target storage block with the least data reading and writing times from the sorted standby storage blocks.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing integrity verification on target data written into a target storage block;
and if the integrity verification is not passed, the target data is re-written into the target storage block.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and updating the data read-write times and the use state corresponding to the target storage block.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not thereby to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of data storage, the method comprising:
acquiring target data to be written into a user identification card;
selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and writing the target data into the target storage block.
2. The method of claim 1, wherein the status of use of the candidate memory block comprises: an occupied state in the case where the data storage block has stored data and an idle state in the case where the data storage block has not stored data.
3. The method according to claim 2, wherein selecting the target memory block from the candidate memory blocks according to the number of times of data reading and writing of the candidate memory blocks in the subscriber identity card and the use state of the candidate memory blocks comprises:
according to the use state of the candidate storage blocks, the candidate storage blocks with the use state of idle states in the user identification card are used as standby storage blocks;
and selecting a target storage block with the minimum data reading and writing times from the standby storage blocks according to the data reading and writing times of the candidate storage blocks.
4. The method of claim 3, wherein selecting the target memory block with the least number of data reads from the spare memory block according to the number of data reads from and writes to the candidate memory block comprises:
based on an bubbling function, sorting the standby storage blocks according to the data read-write times of the candidate storage blocks;
and selecting a target storage block with the least data reading and writing times from the sorted standby storage blocks.
5. The method of claim 1, wherein after writing the target data into the target memory block, the method further comprises:
performing integrity verification on the target data written into the target storage block;
and if the integrity verification is not passed, the target data is rewritten in the target storage block.
6. The method of claim 5, wherein after writing the target data into the target memory block, the method further comprises:
and updating the data read-write times and the use state corresponding to the target storage block.
7. A data storage device, the device comprising:
the acquisition module is used for acquiring target data to be written into the user identification card;
the selection module is used for selecting a target storage block from the candidate storage blocks according to the data read-write times of the candidate storage blocks in the user identification card and the use state of the candidate storage blocks;
and the first writing module is used for writing the target data into the target storage block.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311594674.4A 2023-11-27 2023-11-27 Data storage method, device, computer equipment and storage medium Pending CN117742586A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311594674.4A CN117742586A (en) 2023-11-27 2023-11-27 Data storage method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311594674.4A CN117742586A (en) 2023-11-27 2023-11-27 Data storage method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117742586A true CN117742586A (en) 2024-03-22

Family

ID=90282066

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311594674.4A Pending CN117742586A (en) 2023-11-27 2023-11-27 Data storage method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117742586A (en)

Similar Documents

Publication Publication Date Title
CN114924911B (en) Method, device, equipment and storage medium for backing up effective data of Windows operating system
CN116578410A (en) Resource management method, device, computer equipment and storage medium
CN117742586A (en) Data storage method, device, computer equipment and storage medium
CN115576947A (en) Data management method and device, combined library, electronic equipment and storage medium
CN108073712B (en) Method and device for deleting main data in information system and computer equipment
CN111984554B (en) Data processing method and device
CN117435135B (en) Method, device and system for recovering storage space related to repeated data deletion
CN117633841A (en) Encryption module controller, encryption module, encryption system, and encryption processing method
CN117455386A (en) Resource auditing method and device, computer equipment and storage medium thereof
CN117056220A (en) Batch job testing method and device, computer equipment and storage medium
CN117951751A (en) Multi-core processor data consistency verification device and method
CN118069044A (en) Chip data storage method, device, equipment, medium and product
CN118133331A (en) Privacy protection method and device for chip stored data and computer equipment
CN117349320A (en) Data processing method, device, computer equipment and storage medium
CN116225324A (en) File storage method, device, computer equipment and storage medium thereof
CN117331812A (en) Service code verification method, device, computer equipment, storage medium and product
CN115952136A (en) Equipment data storage method, device, computer equipment and medium
CN115469811A (en) Data storage method, apparatus, device, storage medium and program product
CN117435651A (en) Test data processing method, device, computer equipment and storage medium
CN103577565A (en) Method and device for exporting files to magnetic tape
CN117632009A (en) Data storage method and device based on business application and computer equipment
CN117573036A (en) Data storage method, device, computer equipment and storage medium
CN114510492A (en) Service data processing method and device, computer equipment and storage medium
CN117370948A (en) Information display method, information display device, terminal and computer readable storage medium
CN116401292A (en) Data ordering method, device, computer equipment and 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