Data storage method and device, electronic equipment and storage medium

By identifying the data usage patterns of electronic devices and selecting appropriate storage media for data storage, the problem of fixed storage methods in existing technologies is solved, achieving a balance between access performance and storage capacity, and improving the accuracy and efficiency of data storage.

CN115421650BActive Publication Date: 2026-01-30GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210993479.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-18
Publication Date
2026-01-30
Estimated Expiration
2042-08-18

AI Technical Summary

Technical Problem

The fixed storage methods of existing electronic devices result in poor data storage and access performance, making it impossible to effectively balance access performance and storage capacity.

Method used

By identifying the data usage patterns of the electronic device's operating programs, target storage media with different access speeds are selected from multiple storage media for data storage, including memory, memory with data compression capabilities, disks, and network storage.

Benefits of technology

It achieves a balance between access performance and storage capacity, improving the accuracy and efficiency of data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115421650B_ABST
    Figure CN115421650B_ABST
Patent Text Reader

Abstract

This application discloses a data storage method, apparatus, electronic device, and storage medium, relating to the field of electronic device technology. The method, applied to an electronic device, includes: acquiring usage data of a program running on the electronic device, determining the usage pattern of the usage data, selecting a storage medium corresponding to the usage pattern from multiple storage media as a target storage medium, wherein the multiple storage media have different access speeds, and storing the usage data in the target storage medium. This application achieves a balance between access performance and storage capacity by identifying the usage pattern of the usage data and storing it in different storage levels.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic equipment technology, and more specifically, to a data storage method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the development of science and technology, electronic devices are becoming increasingly widespread and multifunctional, becoming an essential part of people's daily lives. At the same time, with the explosive growth of data in the information age and the rapid development of technologies such as big data and cloud computing, the amount of data is increasing exponentially. Therefore, the requirements for backend storage space in electronic devices are becoming increasingly stringent. However, the current storage methods used in electronic devices are fixed, resulting in poor data storage and access performance. Summary of the Invention

[0003] In view of the above problems, this application proposes a data storage method, apparatus, electronic device, and storage medium to solve the above problems.

[0004] In a first aspect, embodiments of this application provide a data storage method applied to an electronic device. The method includes: acquiring usage data of a program running on the electronic device and determining a usage pattern of the usage data; determining a storage medium corresponding to the usage pattern from a plurality of storage media as a target storage medium, wherein the plurality of storage media have different access speeds; and storing the usage data in the target storage medium.

[0005] Secondly, embodiments of this application provide a data storage device applied to an electronic device. The device includes: a usage mode determination module, configured to acquire usage data of a program running on the electronic device and determine the usage mode of the usage data; a target storage medium determination module, configured to determine, from a plurality of storage media, a storage medium corresponding to the usage mode as a target storage medium, wherein the plurality of storage media each have a different access speed; and a data storage module, configured to store the usage data in the target storage medium.

[0006] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor performs the above-described method.

[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code, which can be invoked by a processor to execute the above-described method.

[0008] The data storage method, apparatus, electronic device, and storage medium provided in this application embodiment acquire usage data of a program running on an electronic device, determine the usage pattern of the usage data, and select a storage medium corresponding to the usage pattern from multiple storage media as the target storage medium. Each of the multiple storage media has a different access speed. The usage data is stored in the target storage medium, thereby achieving a balance between access performance and storage capacity by identifying the usage pattern of the usage data and storing it in different storage levels. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A flowchart illustrating a data storage method provided in an embodiment of this application is shown;

[0011] Figure 2 A flowchart illustrating a data storage method provided in an embodiment of this application is shown;

[0012] Figure 3 A flowchart illustrating a data storage method provided in an embodiment of this application is shown;

[0013] Figure 4 A flowchart illustrating a data storage method provided in an embodiment of this application is shown;

[0014] Figure 5 This application shows Figure 4 A flowchart illustrating an embodiment of step S421 of the data storage method shown;

[0015] Figure 6 This application shows Figure 4 A flowchart illustrating an embodiment of step S421 of the data storage method shown;

[0016] Figure 7 A flowchart illustrating a data storage method provided in an embodiment of this application is shown;

[0017] Figure 8 A block diagram of a data storage device provided in an embodiment of this application is shown;

[0018] Figure 9 A block diagram of an electronic device for performing a data storage method according to an embodiment of the present application is shown;

[0019] Figure 10 A storage unit for storing or carrying program code implementing a data storage method according to an embodiment of the present application is shown. Detailed Implementation

[0020] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0021] Currently, electronic devices store data in memory based on its access frequency, storing less frequently accessed data in compressed memory or on a hard drive. However, this method doesn't consider the actual data usage patterns of users; low access frequency doesn't necessarily mean it can be stored on slower storage media. This can lead to users accessing data stored on slower media, resulting in performance degradation.

[0022] To address the aforementioned problems, the inventors, through long-term research, discovered and proposed the data storage method, apparatus, electronic device, and storage medium provided in the embodiments of this application. By identifying the usage patterns of data, the data is stored in different storage levels to achieve a balance between access performance and storage capacity. The specific data storage method will be described in detail in subsequent embodiments.

[0023] Please see Figure 1 , Figure 1 A flowchart illustrating a data storage method according to an embodiment of this application is shown. This method identifies data usage patterns and stores the data in different storage tiers to achieve a balance between access performance and storage capacity. In a specific embodiment, this data storage method is applied to, for example... Figure 8 The data storage device 200 and the electronic device 100 configured with the data storage device 200 are shown. Figure 9 The following will use an electronic device as an example to illustrate the specific process of this embodiment. Of course, it is understood that the electronic device used in this embodiment may include smartphones, tablets, wearable electronic devices, etc., and is not limited thereto. The following will focus on... Figure 1 The process shown will be described in detail, and the data storage method may specifically include the following steps:

[0024] Step S110: Obtain usage data of the program running on the electronic device, and determine the usage mode of the usage data.

[0025] In this embodiment, usage data of the program running on the electronic device can be obtained, and the usage pattern of the usage data can be determined.

[0026] In some implementations, the data used by the program refers to any data that will be used during the program's operation. For example, as long as the program is running, it will inevitably use data (such as memory data) and will inevitably have some kind of pattern or characteristic.

[0027] In some implementations, the program running on the electronic device may include a program running in the foreground of the electronic device, a program running in the background of the electronic device, or a program that switches between running in the foreground and background of the electronic device, etc., without limitation.

[0028] In one approach, if the electronic device is running a program that uses only one piece of data, then the usage pattern of that single piece of data can be determined; in another approach, if the electronic device is running multiple pieces of data that use data, then the usage pattern of each of those multiple pieces of data can be determined.

[0029] The usage pattern of the data can be used to indicate the amount and manner of its use, thereby better reflecting the relationship between the data and user needs and improving the accuracy of data storage. In some implementations, the electronic device can collect statistics on its data usage during program execution, determine the usage pattern based on this data, establish and store a mapping relationship between the data and its usage pattern, and subsequently, when the usage data of the program running on the electronic device is obtained, the corresponding usage pattern can be determined based on this mapping relationship.

[0030] In some implementations, usage patterns may include: data update frequency, data type, read operation data, write operation data, etc.

[0031] Step S120: From multiple storage media, determine the storage media corresponding to the usage mode as the target storage media, wherein the multiple storage media each have a different access speed.

[0032] In some implementations, the electronic device may pre-configure and store multiple storage media, each with a different access speed. Therefore, in this embodiment, when a usage pattern corresponding to the usage data is determined, the storage media corresponding to that usage pattern can be selected from the multiple storage media, and this storage media can be used as the target storage media.

[0033] As one feasible approach, the electronic device can pre-set and store multiple usage modes, multiple storage media, and the correspondence between the multiple usage modes and multiple storage media. The correspondence between the multiple usage modes and multiple storage media can include: one usage mode corresponding to one storage media, one usage mode corresponding to multiple storage media, or multiple usage modes corresponding to one storage media, etc., and is not limited thereto. Therefore, in this embodiment, when the usage mode of the usage data is determined, the storage media corresponding to the usage mode of the usage data can be determined based on the correspondence between the multiple usage modes and multiple storage media, and the storage media corresponding to the usage mode of the usage data can be determined as the target storage media.

[0034] In some implementations, the plurality of storage media may include: no storage media (no storage); memory; memory with data compression capabilities, and a moderate compression speed and compression ratio, such as LZ4; memory with data compression capabilities, and a slow compression speed and high compression ratio, such as ZSTD; a disk with compression capabilities; a disk; and network storage. Wherein, no storage media means no storage, direct deletion; memory access speed is faster than memory with data compression capabilities; memory with compression capabilities has a higher access speed than disk with compression capabilities; disk with compression capabilities has a higher access speed than disk; and disk access speed is higher than network storage access speed.

[0035] For example, if the data usage pattern indicates a low data update frequency, then from multiple storage media, the target storage medium can be determined as memory with data compression function, which has moderate compression and decompression speed and moderate compression ratio.

[0036] Step S130: Store the data to the target storage medium.

[0037] In this embodiment, when a target storage medium is determined from multiple storage media, the data to be used can be stored in the target storage medium to achieve a balance between access performance and storage capacity.

[0038] An embodiment of this application provides a data storage method that obtains usage data of a program running on an electronic device, determines the usage pattern of the usage data, and selects a storage medium corresponding to the usage pattern from multiple storage media as a target storage medium. Each of the multiple storage media has a different access speed. The usage data is stored in the target storage medium, thereby achieving a balance between access performance and storage capacity by identifying the usage pattern of the usage data and storing it in different storage levels.

[0039] Please see Figure 2 , Figure 2 A flowchart illustrating a data storage method according to an embodiment of this application is shown. This method is applied to the aforementioned electronic device, and will be discussed below. Figure 2 The process shown will be described in detail, and the data storage method may specifically include the following steps:

[0040] Step S210: Obtain usage data of the program running on the electronic device.

[0041] For a detailed description of step S210, please refer to step S110, which will not be repeated here.

[0042] Step S220: Obtain the quantification information of the usage data, and determine the usage information of the usage data based on the quantification information of the usage data.

[0043] In this embodiment, when acquiring usage data of the program running on the electronic device, quantitative information of the usage data can be obtained, and usage information of the usage data can be determined based on the quantitative information. The purpose of acquiring the quantitative information of the usage data is to provide dimensions for considering the usage information, which is the basis for determining the usage information. By using the quantitative information of the data, the usage information of the usage data can be characterized.

[0044] In one approach, if the electronic device is running a program that uses only one piece of data, then the quantitative information of that single piece of data can be obtained; in another approach, if the electronic device is running multiple pieces of data that use data, then the quantitative information of each of those multiple pieces of data can be determined.

[0045] In some implementations, when acquiring usage data of the programs running on the electronic device, the usage of this data can be recorded, and quantitative information about the usage data can be determined based on the recorded usage data. For example, when acquiring usage data of the programs running on the electronic device, the usage of this data can be recorded, and the usage of this data can be statistically analyzed (e.g., the usage of this data within a preset time period) to determine the quantitative information about the usage data.

[0046] In some implementations, if the quantification information of the usage data is obtained, the quantification information can be parsed to determine the usage information of the usage data. As an example, assuming the quantification information of the usage data indicates that the data is rarely used, i.e., the read and write update frequency of the data is very low, then the usage information of the data can be determined as rarely_used to indicate that the data is rarely used.

[0047] Step S230: Determine the usage pattern of the usage data based on the quantitative information of the usage data and the usage information of the usage data.

[0048] In this embodiment, given the quantitative information and usage information of the data, the usage pattern of the data can be determined based on these two information. The quantitative information can be used for qualitative analysis of the data, while the usage information can be used for quantitative analysis. Therefore, combining the quantitative information and the usage information allows for the determination of the data usage pattern (qualitative + quantitative).

[0049] As an example, suppose the quantitative information of data usage includes the amount of data read and write, and the usage information of data usage includes more read operations than write operations, then the data usage pattern can include more reads and fewer writes.

[0050] Step S240: From multiple storage media, determine the storage media corresponding to the usage mode as the target storage media, wherein the multiple storage media each have a different access speed.

[0051] Step S250: Store the data to the target storage medium.

[0052] For a detailed description of steps S240-S250, please refer to steps S120-S130, which will not be repeated here.

[0053] An embodiment of this application provides a data storage method that acquires usage data of a program running on an electronic device, acquires quantification information of the usage data, determines usage information of the usage data based on the quantification information, determines a usage pattern of the usage data based on the usage information and the usage pattern, selects a storage medium corresponding to the usage pattern from multiple storage media as a target storage medium, wherein each of the multiple storage media has a different access speed, and stores the usage data in the target storage medium. Compared to Figure 1 The data storage method shown in this embodiment also obtains quantitative information and usage information of the data, and determines the usage pattern based on the quantitative information and usage information, thereby improving the accuracy of the determined usage pattern.

[0054] Please see Figure 3 , Figure 3 A flowchart illustrating a data storage method according to an embodiment of this application is shown. This method is applied to the aforementioned electronic device, and will be discussed below. Figure 3The process shown will be described in detail, and the data storage method may specifically include the following steps:

[0055] Step S310: Obtain usage data of the program running on the electronic device.

[0056] For a detailed description of step S310, please refer to step S110, which will not be repeated here.

[0057] Step S320: Determine multiple quantization dimensions for the data in use.

[0058] As an feasible approach, the electronic device can be pre-set with multiple quantization dimensions, and these multiple quantization dimensions are applicable to all usage data. That is, all usage data of the program running on the electronic device corresponds to these multiple quantization dimensions. Based on this, in this embodiment, when acquiring the usage data of the program running on the electronic device, the pre-set multiple quantization dimensions can be determined as multiple quantization dimensions applicable to the usage data.

[0059] As another feasible approach, the electronic device can be pre-set with multiple quantization dimensions, and different quantization dimensions correspond to different usage data. That is, the usage data of the program running on the electronic device can correspond to one or more of these multiple quantization dimensions. Based on this, in this embodiment, when acquiring the usage data of the program running on the electronic device, multiple quantization dimensions corresponding to the usage data can be determined from the pre-set multiple quantization dimensions, and used as the multiple quantization dimensions for the usage data.

[0060] In some implementations, the multiple quantification dimensions for the data used may include:

[0061] 1. The level of data operation volume can be divided into N levels according to different distribution rules. Among them, the lowest level represents no operation, the second lowest level means that it only occurs once, and the remaining levels can be determined according to different distribution principles;

[0062] 2. Data is read, and the level of its operation volume;

[0063] 3. Data is written, and the level of its operation volume;

[0064] 4. Data update frequency;

[0065] 5. Data types include integer, floating-point, random content, raw bitmap, and compressed data types (such as JPEG and PNG);

[0066] 6. Data sources include disk data mapped to memory (meaning no modifications were made) and temporary modifications to memory data by the program.

[0067] Step S330: Obtain the quantization information of the data in each of the plurality of quantization dimensions.

[0068] In this embodiment, when multiple quantization dimensions are determined for the usage data, the quantization information of the usage data under each of the multiple quantization dimensions can be obtained. In one approach, if the number of usage data items of the program running on the electronic device is one, the quantization information of that one usage data item under each of the multiple quantization dimensions can be obtained; in another approach, if the number of programs running on the electronic device is multiple, the quantization information of each of the multiple usage data items under each of the multiple quantization dimensions can be determined.

[0069] In some implementations, assuming that the multiple quantization dimensions of the usage data include the above six quantization dimensions, the quantization information of the usage data under each of the above six quantization dimensions can be obtained.

[0070] Step S340: During the use of the data, record the usage of the data and generate an analysis file, wherein the analysis file includes at least the quantitative information of the data.

[0071] In this embodiment, during the use of usage data, the electronic device can record the usage of the usage data and generate an analysis file that includes at least quantitative information of the usage data based on the recorded usage data, thereby providing a basis for determining the usage information of the usage data.

[0072] In some implementations, during the use of data, the electronic device can record the usage of data in real time and generate analysis files, record the usage of data at preset time intervals and generate analysis files, record the usage of data at preset time points and generate analysis files, or record the usage of data and generate analysis files according to other preset rules, etc., without limitation.

[0073] In one approach, during data usage, the electronic device can generate an analysis file as soon as it begins recording data usage, and update the analysis file based on subsequent data usage records. In another approach, the electronic device can generate an analysis file when the number of recorded data usage instances reaches a preset threshold, and update the analysis file based on subsequent data usage records. Yet another approach, the electronic device can generate a "Pink Bear" file when the duration of recorded data usage reaches a preset duration, and update the analysis file based on subsequent data usage records.

[0074] Step S350: Parse the analysis file and determine the preset usage information that the quantitative information of the usage data satisfies from multiple preset usage information, and use it as the usage information of the usage data.

[0075] In this embodiment, if an analysis file is obtained, the analysis file can be parsed to determine the preset usage information that the quantitative information of the usage data satisfies from multiple preset usage information, and the preset usage information that the quantitative information of the usage data satisfies is determined as the usage information of the usage data.

[0076] In some implementations, the electronic device may pre-set and store multiple preset usage information, such as infrequent use, read-heavy and write-light usage, or read-light and write-heavy usage. Therefore, in this embodiment, when an analysis file is obtained, the analysis file can be parsed to determine the preset usage information satisfied by the quantification information of the usage data from the multiple preset usage information, and the preset usage information satisfied by the quantification information of the usage data is determined as the usage information of the usage data.

[0077] As an feasible approach, determining the usage information of data can be achieved through proactive program annotation. This method is suitable for scenarios where users are very familiar with how the program operates and can anticipate its predetermined behavior, i.e., how it uses data. Specific methods can include: the program manually specifying the access method for certain data, either using compiler-provided syntax or explicitly declaring it in a configuration file. For example, if quantitative information about the data reveals that it is rarely used (i.e., read, write, and update frequencies are very low), it can be specified as `rarely_used`, indicating that the data is rarely used.

[0078] As another feasible approach, determining usage information for data can be achieved through analyzing runtime data and then actively labeling it. This method is suitable when users are unsure how the program specifically uses the data. Specifically, this can involve recording the usage of each data point and dynamically generating an analysis file on disk. This file details the usage and type of each data point that meets the criteria (data in memory and data on disk). After the program has run for a certain period, such as completing a full functional test, or directly obtaining data from real user usage, users can analyze this file to obtain confirmation information and then manually label the data.

[0079] As another feasible approach, determining the usage information of data can be achieved using dynamic adjustment technology based on runtime data. This method is suitable for scenarios completely free from human intervention. Specifically, it can involve recording the usage of each piece of data and dynamically generating an analysis file on the disk. This file details the usage of each data point that meets the criteria (data in memory and data on disk) and their types. The analysis program interprets the generated analysis file and automatically marks the data that meets the criteria as valid according to certain rules, thus achieving automatic labeling of the usage information.

[0080] Step S360: Based on the quantitative information of the usage data and the usage information of the usage data, determine the usage pattern of the usage data.

[0081] For a detailed description of step S360, please refer to step S230, which will not be repeated here.

[0082] Step S370: From multiple storage media, determine the storage media corresponding to the usage mode as the target storage media, wherein the multiple storage media each have a different access speed.

[0083] Step S380: Store the data to the target storage medium.

[0084] For a detailed description of steps S370-S380, please refer to steps S120-S130, which will not be repeated here.

[0085] An embodiment of this application provides a data storage method that acquires usage data from a program running on an electronic device, determines multiple quantization dimensions for the usage data, acquires quantization information for each of the multiple quantization dimensions, records the usage of the usage data during its use, and generates an analysis file, wherein the analysis file includes at least the quantization information of the usage data. The analysis file is parsed, and preset usage information satisfying the quantization information of the usage data is determined from multiple preset usage information sets, which is used as the usage information of the usage data. Based on the quantization information and the usage information of the usage data, a usage pattern of the usage data is determined. From multiple storage media, a storage medium corresponding to the usage pattern is determined as a target storage medium, wherein each of the multiple storage media has a different access speed. The usage data is stored in the target storage medium. Compared to... Figure 1 The data storage method shown in this embodiment also acquires the quantitative information of the usage data under each of multiple quantitative dimensions to improve the accuracy and diversity of the acquired quantitative information. Furthermore, this embodiment also achieves automatic annotation of usage information by analyzing and comparing the usage of the usage data, thereby improving the speed and accuracy of the acquired usage information.

[0086] Please see Figure 4 , Figure 4 A flowchart illustrating a data storage method according to an embodiment of this application is shown. This method is applied to the aforementioned electronic device, and will be discussed below. Figure 4 The process shown will be described in detail, and the data storage method may specifically include the following steps:

[0087] Step S410: Obtain usage data of the program running on the electronic device, and determine the usage mode of the usage data.

[0088] For a detailed description of step S410, please refer to step S110, which will not be repeated here.

[0089] Step S420: Obtain access information corresponding to the usage data, wherein the access information includes data that belongs to recent access or data that does not belong to recent access.

[0090] In this embodiment, in addition to obtaining the usage mode corresponding to the usage data, the electronic device can also obtain the access information corresponding to the usage data. The access information may include data that belongs to recent access or data that does not belong to recent access.

[0091] In some implementations, the electronic device may simultaneously acquire the usage mode corresponding to the usage data and the access information corresponding to the usage data; it may acquire the usage mode corresponding to the usage data first and then acquire the access information corresponding to the usage data; or it may acquire the access information corresponding to the usage data first and then acquire the usage mode corresponding to the usage data, etc., without limitation.

[0092] The purpose of obtaining access information corresponding to usage data is to determine whether the usage data belongs to the recent access data of the electronic device. That is, based on the access information corresponding to the usage data, it can be determined that the usage data belongs to the recent access data of the electronic device, or, based on the access information corresponding to the usage data, it can be determined that the usage data does not belong to the recent access data of the electronic device. One feasible approach is to obtain the access time of the usage data and determine the access information corresponding to the usage data based on the access time. Another feasible approach is to obtain the access frequency of the usage data and determine the access information corresponding to the usage data based on the access frequency.

[0093] Please see Figure 5 , Figure 5 This application shows Figure 4 The flowchart illustrates an embodiment of step S421 of the data storage method shown. The following will focus on... Figure 5 The process shown will be described in detail, and the method may specifically include the following steps:

[0094] Step S421A: Obtain access data of the electronic device within the most recent preset time period.

[0095] In some implementations, the electronic device may pre-set and store a preset duration, which serves as the basis for determining the recent access data of the electronic device. That is, if the time when the electronic device accesses certain usage data is within the most recent preset duration, the accessed usage data can be considered recently accessed data; if the time when the electronic device accesses certain usage data is not within the most recent preset duration, the accessed usage data can be considered not recently accessed data. The most recent preset duration may include approximately N seconds.

[0096] In this embodiment, access data of the electronic device within the most recent preset time period can be obtained. For example, access data of the electronic device within the last N seconds can be obtained.

[0097] Step S422A: Based on the relationship between the access data and the usage data of the electronic device within the most recent preset time period, determine the access information corresponding to the usage data.

[0098] In this embodiment, when access data of the electronic device within the most recent preset time period is obtained, the relationship between the access data and the usage data of the electronic device within the most recent preset time period can be determined, and based on the relationship between the access data and the usage data of the electronic device within the most recent preset time period, the access information corresponding to the usage data can be determined.

[0099] In some implementations, when access data of the electronic device within the most recent preset time period is obtained, the access data within the most recent preset time period can be compared with the usage data to determine whether the access data within the most recent preset time period includes the usage data. Specifically, if it is determined that the access data within the most recent preset time period includes the usage data, then the usage data can be determined to be recent access data; if it is determined that the access data within the most recent preset time period does not include the usage data, then the usage data can be determined to be not recent access data.

[0100] Please see Figure 6 , Figure 6 This application shows Figure 4 The flowchart illustrates an embodiment of step S421 of the data storage method shown. The following will focus on... Figure 6 The process shown will be described in detail, and the method may specifically include the following steps:

[0101] Step S421B: Obtain access data of the electronic device within the most recent preset capacity.

[0102] In some implementations, the electronic device may pre-set and store a preset capacity, which serves as the basis for determining the recently accessed data of the electronic device. That is, when the usage data accessed by the electronic device is within the recent preset capacity, it can be considered that the usage data accessed by the electronic device is recently accessed; when the usage data accessed by the electronic device is not within the recent preset capacity, it can be considered that the usage data accessed by the electronic device is not recently accessed. The recent preset capacity may include approximately M KB.

[0103] In this embodiment, access data of the electronic device within the most recent preset capacity can be obtained. For example, access data of the electronic device within the last M KB can be obtained.

[0104] Step S422B: Based on the relationship between the access data and the usage data of the electronic device within the most recent preset capacity, determine the access information corresponding to the usage data.

[0105] In this embodiment, if access data of the electronic device within the most recent preset capacity is obtained, the relationship between the access data of the electronic device within the most recent preset capacity and the usage data can be determined, and based on the relationship between the access data of the electronic device within the most recent preset capacity and the usage data, the access information corresponding to the usage data can be determined.

[0106] In some implementations, when access data of the electronic device within the most recent preset capacity is obtained, the access data within the most recent preset capacity can be compared with the usage data to determine whether the access data within the most recent preset capacity includes the usage data. Specifically, if it is determined that the access data within the most recent preset capacity includes the usage data, then the usage data can be determined to be recent access data; if it is determined that the access data within the most recent preset capacity does not include the usage data, then the usage data can be determined to be not recent access data.

[0107] Step S430: From the plurality of storage media, determine the storage media corresponding to the usage mode and the access information as the target storage media, wherein the plurality of storage media have different access speeds.

[0108] In this embodiment, if the usage mode corresponding to the usage data and the access information corresponding to the usage data are determined, the storage medium corresponding to the usage mode and the access information can be determined from multiple storage media, and the storage medium corresponding to the usage mode and the access information can be used as the target storage medium.

[0109] As one feasible approach, electronic devices can pre-set and store multiple usage modes, multiple storage media, multiple access information, and the corresponding relationships between these multiple usage modes, storage media, and access information. Therefore, in this embodiment, when the usage mode and access information corresponding to the usage data are determined, the storage media corresponding to the usage mode and access information can be determined based on the corresponding relationships between the multiple usage modes, access information, and storage media, and the usage mode and storage media corresponding to the usage mode can be identified as the target storage media.

[0110] Step S440: Store the data to the target storage medium.

[0111] For a detailed description of step S440, please refer to step S130, which will not be repeated here.

[0112] An embodiment of this application provides a data storage method that acquires usage data of a program running on an electronic device, determines the usage pattern of the usage data, acquires access information corresponding to the usage data, wherein the access information includes recently accessed data or not recently accessed data, determines a storage medium corresponding to the usage pattern and the access information from multiple storage media as a target storage medium, wherein the multiple storage media each have different access speeds, and stores the usage data in the target storage medium. Compared to Figure 1 The data storage method shown in this embodiment also obtains access information of the usage data, and determines the target storage medium based on the usage pattern and access information, thereby improving the accuracy of the determined target storage medium.

[0113] Please see Figure 7 , Figure 7 A flowchart illustrating a data storage method according to an embodiment of this application is shown. This method is applied to the aforementioned electronic device, and will be discussed below. Figure 7 The process shown will be described in detail, and the data storage method may specifically include the following steps:

[0114] Step S510: Obtain usage data of the program running on the electronic device, and determine the usage mode of the usage data.

[0115] For a detailed description of step S510, please refer to step S110, which will not be repeated here.

[0116] Step S520: Obtain the association between the usage data and the front-end operation, wherein the association includes being related or not related.

[0117] In this embodiment, in addition to obtaining the usage mode corresponding to the usage data, the electronic device can also obtain the association relationship between the usage data and the foreground operation, wherein the association relationship may include being associated or not.

[0118] In some implementations, the electronic device can simultaneously obtain the usage mode corresponding to the usage data and the association between the usage data and the foreground operation; it can obtain the usage mode corresponding to the usage data first and then obtain the association between the usage data and the foreground operation; it can obtain the association between the usage data and the foreground operation first and then obtain the usage mode corresponding to the usage data, etc., without limitation.

[0119] The purpose of obtaining the association between usage data and foreground operations is to determine whether the usage data is associated with the foreground operations of the electronic device. That is, based on the association between the usage data and the foreground operations, it can be determined that the usage data is associated with the foreground operations; conversely, based on the association between the usage data and the foreground operations, it can be determined that the usage data is not associated with the foreground operations. As one feasible approach, the call data of the foreground operations of the electronic device can be obtained. When the call data includes the usage data, it can be determined that the usage data is associated with the foreground operations; when the call data does not include the usage data, it can be determined that the usage data is not associated with the foreground operations.

[0120] Step S530: From the plurality of storage media, determine the storage media corresponding to the usage mode and the association relationship as the target storage media, wherein the plurality of storage media have different access speeds.

[0121] In this embodiment, after determining the usage pattern corresponding to the usage data and the association between the usage data and the foreground operation, the storage medium corresponding to the usage pattern and the association can be determined from multiple storage media, and the storage medium corresponding to the usage pattern and the association can be used as the target storage medium.

[0122] As an feasible approach, electronic devices can pre-set and store multiple usage modes, multiple storage media, multiple associations, and the corresponding relationships between these multiple usage modes, storage media, and associations. Therefore, in this embodiment, when the usage mode corresponding to the usage data and its association with the foreground operation are determined, the storage media corresponding to the usage mode and association of the usage data can be determined based on the corresponding relationships between the multiple usage modes, multiple associations, and multiple storage media, and the storage media corresponding to the usage mode and association of the usage data can be identified as the target storage media.

[0123] As an example, assuming that the data being used is associated with foreground operations (relationship), that the data being used is not recently accessed (access information), and that the data being used has a low update frequency (usage pattern), then if there is a lot of reading and writing, with more writing than reading or less writing than reading (usage pattern), then the storage medium that is "memory with data compression capabilities, and with moderate compression speed and moderate compression ratio" can be identified as the target storage medium; if there is very little reading and writing (usage pattern), then the storage medium that is "disk with compression capabilities" can be identified as the target storage medium.

[0124] As another example, assuming that the data being used is not related to the foreground operation (relationship), the data being used is not recently accessed data (access information), and the data being used has a low update frequency (usage pattern), then if the amount of data being read or written is large (usage pattern), then the storage medium "memory with data compression function, and its compression speed is slow but its compression ratio is high" will be determined as the target storage medium; otherwise, the storage medium "disk with compression function" will be determined as the target storage medium.

[0125] Step S540: Store the data to the target storage medium.

[0126] For a detailed description of step S540, please refer to step S130, which will not be repeated here.

[0127] An embodiment of this application provides a data storage method that acquires usage data of a program running on an electronic device, determines the usage pattern of the usage data, acquires the association between the usage data and foreground operations, wherein the association includes being related or not related, and determines a storage medium corresponding to the usage pattern and association from multiple storage media as a target storage medium, wherein the multiple storage media have different access speeds, and stores the usage data in the target storage medium. Compared to Figure 1 The data storage method shown in this embodiment also obtains the association between the usage data and the front-end operation, and determines the target storage medium based on the usage pattern and the association, thereby improving the accuracy of the determined target storage medium.

[0128] Please see Figure 8 , Figure 8 A block diagram of a data storage device 200 according to an embodiment of this application is shown. This data storage device 200 is applied to the aforementioned electronic device, and will be discussed below. Figure 8 The block diagram shown illustrates that the data storage device 200 includes: a usage mode determination module 210, a target storage medium determination module 220, and a data storage module 230, wherein:

[0129] The usage mode determination module 210 is used to acquire usage data of the program running on the electronic device and determine the usage mode of the usage data.

[0130] Further, the usage mode determination module 210 includes: an information determination submodule and a usage mode determination submodule, wherein:

[0131] The information determination submodule is used to obtain the quantitative information of the usage data and determine the usage information of the usage data based on the quantitative information of the usage data.

[0132] Furthermore, the information determination submodule includes: a quantization dimension determination unit and a quantization information acquisition unit, wherein:

[0133] A quantization dimension determination unit is used to determine multiple quantization dimensions for the data in use.

[0134] The quantization information acquisition unit is used to acquire the quantization information of the data in each of the multiple quantization dimensions.

[0135] Furthermore, the information determination submodule includes: an analysis file generation unit and a usage information determination unit, wherein:

[0136] An analysis file generation unit is used to record the usage of the usage data and generate an analysis file during the usage process, wherein the analysis file includes at least the quantitative information of the usage data.

[0137] The information determination unit is used to parse the analysis file and determine the preset usage information that the quantitative information of the usage data satisfies from multiple preset usage information, and use it as the usage information of the usage data.

[0138] The usage pattern determination submodule is used to determine the usage pattern of the usage data based on the quantitative information of the usage data and the usage information of the usage data.

[0139] The target storage medium determination module 220 is used to determine, from a plurality of storage media, the storage medium corresponding to the usage mode as the target storage medium, wherein the plurality of storage media each have a different access speed.

[0140] Further, the target storage medium determination module 220 includes: an access information acquisition submodule and a first target storage medium determination submodule, wherein:

[0141] The access information acquisition submodule is used to acquire access information corresponding to the usage data, wherein the access information includes data that belongs to recent access or data that does not belong to recent access.

[0142] Further, the access information acquisition submodule includes: a first access data acquisition unit and a first access information acquisition unit, wherein:

[0143] The first access data acquisition unit is used to acquire the access data of the electronic device within the most recent preset time period.

[0144] The first access information acquisition unit is used to determine the access information corresponding to the usage data based on the relationship between the access data of the electronic device in the most recent preset time period and the usage data.

[0145] Furthermore, the access information acquisition submodule includes: a second access data acquisition unit and a second access information acquisition unit, wherein:

[0146] The second access data acquisition unit is used to acquire access data of the electronic device within the most recent preset capacity.

[0147] The second access information acquisition unit is used to determine the access information corresponding to the usage data based on the relationship between the access data of the electronic device within the most recent preset capacity and the usage data.

[0148] The first target storage medium determination submodule is used to determine, from the plurality of storage media, the storage medium corresponding to the usage mode and the access information as the target storage medium.

[0149] Further, the target storage medium determination module 220 includes: an association relationship acquisition submodule and a second target storage medium determination submodule, wherein:

[0150] The relationship acquisition submodule is used to acquire the relationship between the usage data and the front-end operation, wherein the relationship includes being related or not related.

[0151] The second target storage medium determination submodule is used to determine, from the plurality of storage media, the storage medium corresponding to the usage mode and the association relationship as the target storage medium.

[0152] Data storage module 230 is used to store the used data to the target storage medium.

[0153] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0154] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0155] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0156] Please see Figure 9This document illustrates a structural block diagram of an electronic device 100 provided in an embodiment of this application. The electronic device 100 can be a smartphone, tablet computer, e-reader, or other electronic device capable of running applications. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications can be stored in the memory 120 and configured to be executed by one or more processors 110, and the one or more applications are configured to perform the methods described in the foregoing method embodiments.

[0157] The processor 110 may include one or more processing cores. The processor 110 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and by calling data stored in the memory 120. Optionally, the processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 110 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 110 and may be implemented separately using a communication chip.

[0158] The memory 120 may include random access memory (RAM) or read-only memory (ROM). The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).

[0159] Please see Figure 10 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 300 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0160] The computer-readable storage medium 300 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 300 has storage space for program code 310 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 310 may be compressed, for example, in a suitable form.

[0161] In summary, the data storage method, apparatus, electronic device, and storage medium provided in this application embodiment acquire usage data of a program running on an electronic device, determine the usage pattern of the usage data, and select a storage medium corresponding to the usage pattern from multiple storage media as the target storage medium. Each of the multiple storage media has a different access speed. The usage data is stored in the target storage medium, thereby achieving a balance between access performance and storage capacity by identifying the usage pattern of the usage data and storing it in different storage levels.

[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A data storage method characterized by comprising: The method is applied to an electronic device, and the method comprises: obtaining usage data of a program running on the electronic device, and determining a plurality of quantization dimensions for the usage data, wherein the plurality of quantization dimensions comprise a level of a quantity of data operations, a level of a read operation and a quantity of operations, a level of a write operation and a quantity of operations, a data update frequency, a data type, and a data source; obtaining quantization information of the usage data in each of the plurality of quantization dimensions, and determining usage information of the usage data based on the quantization information of the usage data; determining a usage mode of the usage data based on the quantization information of the usage data and the usage information of the usage data; determining, from a plurality of storage media, a storage medium corresponding to the usage mode as a target storage medium, wherein the plurality of storage media each correspond to different access speeds, and wherein the plurality of storage media comprise no storage, memory, memory with a data compression function and a compression and decompression speed and a compression rate that are moderate, memory with a data compression function and a slow compression speed and a high compression rate, a disk with a compression function, a disk, and network storage; storing the usage data to the target storage medium.

2. The method of claim 1, wherein, The determination of the usage information of the usage data based on the quantization information of the usage data comprises: recording usage of the usage data and generating an analysis file during a usage process of the usage data, wherein the analysis file at least comprises the quantization information of the usage data; parsing the analysis file, and determining, from a plurality of preset usage information, preset usage information that satisfies the quantization information of the usage data as the usage information of the usage data.

3. The method according to claim 1 or 2, characterized in that, The determination, from a plurality of storage media, of a storage medium corresponding to the usage mode as a target storage medium comprises: obtaining access information corresponding to the usage data, wherein the access information comprises recent access data or non-recent access data; determining, from the plurality of storage media, a storage medium corresponding to the usage mode and the access information as the target storage medium.

4. The method of claim 3, wherein, The obtaining of the access information corresponding to the usage data comprises: obtaining access data of the electronic device within a recent preset time length; determining the access information corresponding to the usage data based on a relationship between the access data of the electronic device within the recent preset time length and the usage data.

5. The method of claim 3, wherein, The obtaining of the access information corresponding to the usage data comprises: obtaining access data of the electronic device within a recent preset capacity; determining the access information corresponding to the usage data based on a relationship between the access data of the electronic device within the recent preset capacity and the usage data.

6. The method of claim 1 or 2, wherein, The determination, from a plurality of storage media, of a storage medium corresponding to the usage mode as a target storage medium comprises: obtaining an association relationship between the usage data and a foreground operation, wherein the association relationship comprises association or non-association; determining, from the plurality of storage media, a storage medium corresponding to the usage mode and the association relationship as the target storage medium.

7. A storage device for data, characterized by The device is applied to an electronic device, and the device comprises: The use mode determining module is configured to acquire use data of a program running on the electronic device, and determine a plurality of quantization dimensions for the use data, wherein the plurality of quantization dimensions include a level of an amount of data operation, a read operation and an operation amount level, a write operation and an operation amount level, a data update frequency, a data type, and a data source; acquire quantization information of the use data in each quantization dimension of the plurality of quantization dimensions, and determine use information of the use data based on the quantization information of the use data; and determine a use mode of the use data based on the quantization information of the use data and the use information of the use data. The target storage medium determining module is configured to determine, from a plurality of storage media, a storage medium corresponding to the use mode as a target storage medium, wherein the plurality of storage media each correspond to different access speeds, and wherein the plurality of storage media include none, a memory, a memory with a data compression function and a compression and decompression speed and a compression rate that are moderate, a memory with a data compression function and a slow compression speed and a high compression rate, a disk with a compression function, a disk, and a network storage. The data storage module is configured to store the use data to the target storage medium.

8. An electronic device, comprising: The computer readable storage medium stores program code, which can be invoked by a processor to execute the method of any one of claims 1-6.

9. A computer readable storage medium, characterized in that, The computer readable storage medium stores program code, which can be invoked by a processor to execute the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Data memory management system and method

    CN106155929A

  • Data storage method and device, and storage medium

    CN108829344A

  • Data storage method and device, storage medium and electronic equipment

    CN114327273A