CN112835819A - Data access method and device - Google Patents

Data access method and device Download PDF

Info

Publication number
CN112835819A
CN112835819A CN201911160536.9A CN201911160536A CN112835819A CN 112835819 A CN112835819 A CN 112835819A CN 201911160536 A CN201911160536 A CN 201911160536A CN 112835819 A CN112835819 A CN 112835819A
Authority
CN
China
Prior art keywords
data
accessed
parameter value
parameter
cache
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
CN201911160536.9A
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.)
Xian Novastar Electronic Technology Co Ltd
Original Assignee
Xian Novastar Electronic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Novastar Electronic Technology Co Ltd filed Critical Xian Novastar Electronic Technology Co Ltd
Priority to CN201911160536.9A priority Critical patent/CN112835819A/en
Publication of CN112835819A publication Critical patent/CN112835819A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The embodiment of the invention discloses a data access method and a device thereof. The data access method comprises the following steps: determining parameters of data to be accessed; generating a corresponding cache key according to the data parameter to be accessed; judging whether the cache key is cached in a data cache object of an internal memory; when the judgment result is negative, reading a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory, and correspondingly caching the cache key and the to-be-accessed data parameter value into the data cache object; and when the judgment result is yes, directly acquiring the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key. The embodiment of the invention can improve the data access efficiency.

Description

Data access method and device
Technical Field
The present invention relates to the field of data access technologies, and in particular, to a data access method and a data access device.
Background
During the use process, the device, such as an embedded device, reads the same data parameter and its parameter value to the memory for use. However, since the device is limited by the size of the hardware memory of the device and there is no data persistence mechanism, the data parameters and data parameter values cached in the memory are removed and the resources are recycled after being used. When the data parameter and the data parameter value need to be used again, the memory reads the data parameter and the data parameter value from the outside again, and the reading efficiency is low.
Therefore, how to improve the reading efficiency when the device reads data becomes an urgent problem to be solved.
Disclosure of Invention
The embodiment of the invention provides a data access method, a data access device, a data access system and a computer readable storage medium, which can improve the data access efficiency.
In one aspect, a data access method provided in an embodiment of the present invention includes: determining parameters of data to be accessed; generating a corresponding cache key according to the data parameter to be accessed; judging whether the cache key is cached in a data cache object of an internal memory; when the judgment result is negative, reading a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory, and correspondingly caching the cache key and the to-be-accessed data parameter value into the data cache object; and when the judgment result is yes, directly acquiring the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key.
According to the embodiment of the invention, the only cache key is generated by reading the data parameter to be accessed of the parameter value according to the requirement, and the data parameter value to be accessed of the data parameter to be accessed is cached to the data cache object in the memory through the cache key, so that the data cache object is directly read from the memory when the data is accessed again, the problem of low data reading efficiency caused by reading the data parameter value to be accessed from the outside every time in the prior art is solved, and the data access efficiency is improved.
In an embodiment of the present invention, after the correspondingly caching the cache key and the parameter value of the data to be accessed in the data cache object in the memory, the method further includes: determining the expiration time of the parameter value of the data to be accessed; and caching the expiration time corresponding to the parameter value of the data to be accessed.
In an embodiment of the present invention, the data access method further includes: judging whether the parameter value of the data to be accessed is overdue or not; and when the judgment result is yes, removing the data cache object to which the parameter value of the data to be accessed belongs from the memory.
In an embodiment of the present invention, the determining whether the value of the to-be-accessed data parameter is expired includes: acquiring current time; traversing a data cache object in the memory according to the cache key to acquire expiration time corresponding to the parameter value of the data to be accessed; comparing the expiration time of the value of the data parameter to be accessed with the current time; and when the current time is greater than the expiration time, the judgment result is yes, otherwise, the judgment result is no.
In an embodiment of the present invention, before the directly obtaining, according to the cache key, a value of a data parameter to be accessed corresponding to the parameter of the data to be accessed from the data cache object, the method further includes: and judging whether the parameter value of the data to be accessed is expired.
On the other hand, an embodiment of the present invention provides a data access apparatus, including: the data parameter determining module is used for determining the parameters of the data to be accessed; the cache key generation module is used for generating a corresponding cache key according to the data parameter to be accessed; the first judgment module is used for judging whether the cache key is cached in a data cache object of the memory; the first data reading module is used for reading a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory and correspondingly caching the cache key and the to-be-accessed data parameter value into the data cache object when the judgment result is negative; and the second data reading module is used for directly acquiring the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key when the judgment result is yes.
In an embodiment of the present invention, the first data reading module is further configured to: determining the expiration time of the parameter value of the data to be accessed; and caching the expiration time corresponding to the parameter value of the data to be accessed.
In one embodiment of the present invention, the data access apparatus further includes: the second judgment module is used for judging whether the parameter value of the data to be accessed is overdue or not; and the cache data removing module is used for removing the data cache object to which the parameter value of the data to be accessed belongs from the memory when the judgment result is yes.
In an embodiment of the present invention, the second determining module is specifically configured to: acquiring current time; comparing the expiration time of the value of the data parameter to be accessed with the current time; and when the current time is greater than the expiration time, the judgment result is yes, otherwise, the judgment result is no.
In an embodiment of the present invention, the second data reading module is further configured to: and judging whether the parameter value of the data to be accessed is expired.
In another aspect, an embodiment of the present invention provides a data access system, including: a memory and a processor connected to the memory, the memory storing a computer program, the processor executing the computer program to perform the data access method of any one of the preceding claims.
In still another aspect, an embodiment of the present invention provides a computer-readable storage medium, which is a non-volatile memory and stores computer-executable instructions, where the computer-executable instructions are configured to perform a data access method according to any one of the foregoing methods.
One or more of the above technical solutions may have the following advantages or beneficial effects: according to the embodiment of the invention, the only cache key is generated by reading the data parameter to be accessed of the parameter value according to the requirement, and the data parameter value to be accessed of the data parameter to be accessed is cached to the data cache object in the memory through the cache key, so that the data cache object is directly read from the memory when the data is accessed again, the problem of low data reading efficiency caused by reading the data parameter value to be accessed from the outside every time in the prior art is solved, and the data access efficiency is improved. In addition, determining expiration time and validity period for the parameter values of the data to be accessed, caching the parameter values correspondingly, monitoring whether the data cache objects are expired or not in real time, and timely and automatically cleaning the expired data cache objects when the data cache objects are expired so as to release the occupied memory of the data cache objects. Moreover, after the parameter value of the data to be accessed is cached in the data cache object in the memory, the video splicing software judges whether the parameter value of the data to be accessed is expired or not before directly acquiring the parameter value of the data to be accessed from the corresponding data cache object in the memory according to the cache key, and then acquires the parameter value of the data to be accessed for use, so that the validity of the parameter value of the data to be accessed acquired by the video splicing software can be ensured, and the stability is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a data access method according to a first embodiment of the present invention.
Fig. 2A is a detailed flowchart of the data access method of the present invention.
Fig. 2B is another detailed flowchart of the data access method of the present invention.
Fig. 3A is a block diagram of a data access device according to a second embodiment of the present invention.
Fig. 3B is another block diagram of a data access device according to a second embodiment of the present invention.
Fig. 4 is a schematic structural diagram of a data access system according to a third embodiment of the present invention.
Fig. 5 is a schematic structural diagram of a computer-readable storage medium according to a fourth embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
[ first embodiment ] A method for manufacturing a semiconductor device
As shown in fig. 1, a first embodiment of the present invention provides a data access method. The data access method may be, for example, applicable to data caching in a memory of a device, such as a video splicer, and specifically, the data access method provided in the embodiment of the present invention includes, for example, the steps of:
s11: determining parameters of data to be accessed;
s12: generating a corresponding cache key according to the data parameter to be accessed;
s13: judging whether the cache key is cached in a data cache object of an internal memory;
s14: when the judgment result is negative, reading a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory, and correspondingly caching the cache key and the to-be-accessed data parameter value into the data cache object;
s15: and when the judgment result is yes, directly acquiring the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key.
Therefore, the unique cache key is generated by reading the data parameter to be accessed of the parameter value according to the requirement, and the data parameter value to be accessed of the data parameter to be accessed is cached to the data cache object in the memory through the cache key so as to be directly read from the memory when the data cache object is accessed again, the problem of low data reading efficiency caused by the fact that the data parameter value to be accessed is read from the outside every time in the prior art is solved, and the data access efficiency is improved.
Further, after the step S14 of correspondingly caching the cache key and the to-be-accessed data parameter value into the data cache object in the memory, the method further includes:
determining the expiration time of the parameter value of the data to be accessed; and
and caching the expiration time corresponding to the parameter value of the data to be accessed.
In another embodiment of the present invention, the data access method provided in the embodiment of the present invention further includes the steps of:
judging whether the parameter value of the data to be accessed is overdue or not;
and when the judgment result is yes, removing the data cache object to which the parameter value of the data to be accessed belongs from the memory.
Therefore, the data cache objects corresponding to the expired data parameters to be accessed can be timely and automatically removed and cleaned, and the memory occupation is saved.
Specifically, the determining whether the parameter value of the data to be accessed is expired includes:
acquiring current time;
comparing the expiration time of the value of the data parameter to be accessed with the current time;
and when the current time is greater than the expiration time, the judgment result is yes, otherwise, the judgment result is no.
In step S15, before directly obtaining the value of the data parameter to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key, the method further includes: and judging whether the parameter value of the data to be accessed is expired. In this way, the validity of the values of the data parameters to be accessed that can be read can be ensured.
In order to facilitate understanding of the present invention, each step of the data access method of the present embodiment will be described in detail below with reference to fig. 2A and 2B.
The present invention takes a video splicer as an example to explain the data access method in detail, and of course, other devices with processors may be taken as an example to explain the method. The video splicer is, for example, configured to receive a plurality of input video sources, perform video processing, splicing processing, and the like on the plurality of video sources to obtain spliced videos, and then output the spliced videos to a display screen for display. The video splicer includes, for example, an embedded processor. The embedded processor is provided with an embedded system. When the video splicer processes multiple video sources, the embedded processor may need to access and read a series of data parameters and data parameter values from outside the memory. The data parameters herein include, for example, service data parameters and service data parameter values. The service data parameters herein include, for example: the number of video sources, the number of display boxes, the voltage of a video splicer and other parameters and parameter values thereof. Of course, the data parameter may also include other management data parameters, and the invention is not limited thereto. The data access method provided by the embodiment of the invention can be realized by software installed on an embedded system, such as video splicing software, and the specific process is as follows.
First, as shown in fig. 2A, the video stitching software determines the parameters of the data to be accessed. Here the data parameters to be accessed are for example the number of input layers, the number of display bins, for example LED bins, etc.
Secondly, the video splicing software generates a corresponding cache key according to the data parameter to be accessed. Specifically, the video stitching software generates corresponding cache keys (keys) according to the parameters of the data to be accessed according to preset rules, wherein the keys are in one-to-one correspondence with the parameters of the data to be accessed and are only used for identifying the parameters of the data to be accessed, the number of the parameters of the data to be accessed is multiple, and the cache keys also can identify a group of parameters of the data to be accessed. The key value may be represented, for example, as 4 bytes.
And then, the video splicing software judges whether the cache key is cached in a data cache object of the memory. Specifically, the video stitching software queries a data cache object in the memory according to the cache key, and determines whether the data parameter to be accessed and the data parameter value to be accessed corresponding to the cache key (key) are cached in the memory. The data cache object here is, for example, an instance of a cache data structure, such as a dictionary type (dit) data structure in python. The data cache object includes a key value and a value. The key values correspond to the value values one to one. The value is used for storing the value of the data parameter to be accessed corresponding to the data parameter to be accessed. The value here may comprise one or more parameter values. And when the key value inquired in the memory is the same as the key value corresponding to the to-be-accessed data parameter to be read, indicating that the to-be-accessed data parameter value of the to-be-accessed data parameter is cached in the memory, and judging that the result is 'yes'. And when the key value is not inquired in the memory to be the same as the key value corresponding to the to-be-accessed data parameter to be read, indicating that the to-be-accessed data parameter value of the to-be-accessed data parameter is not cached in the memory, and judging that the result is 'no'.
And when the judgment result is yes, the video splicing software directly acquires the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key. Therefore, the video splicing software can directly read the parameter value of the data to be accessed from the memory without reading the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the outside, and the data access efficiency and speed are improved.
And when the judgment result is negative, the video splicing software reads the to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory, and correspondingly caches the cache key and the to-be-accessed data parameter value into the data cache object, so that when the video splicing software reads the to-be-accessed data parameter value corresponding to the to-be-accessed data parameter again according to the cache key, the to-be-accessed data parameter value can be directly read from the memory, and the data access efficiency and speed are improved. Therefore, the parameter value of the data to be accessed can be quickly read, and the problem of low data reading efficiency caused by reading the parameter value of the data to be accessed from the outside every time in the prior art is solved.
Further, as shown in fig. 2B, after the cache key and the parameter value of the data to be accessed are correspondingly cached in the data cache object, the video stitching software may further determine the expiration time of the parameter value of the data to be accessed, and then cache the expiration time corresponding to the parameter value of the data to be accessed. Specifically, the video stitching software obtains the time for caching the parameter value of the data to be accessed, then adds the preset validity period of the parameter value of the data to be accessed to obtain the expiration time of the parameter value of the data to be accessed, and finally caches the expiration time. The preset validity period may be, for example, 60 seconds, but may also be other times, and the present invention is not limited thereto.
As shown in fig. 2B, the video stitching software may further determine whether to further reserve the data cache object of the data parameter to be accessed corresponding to the data parameter value to be accessed by judging whether the data parameter value to be accessed is expired. Specifically, the video splicing software judges whether the parameter value of the data to be accessed is overdue or not, and a judgment result is obtained. When the judgment result is yes, the video splicing software removes the data cache object where the parameter value of the data to be accessed is located from the memory, so that the video splicing software can timely and automatically clean the overdue data cache object, the occupation of the memory is reduced, and the operation efficiency of the system is further improved. More specifically, the video stitching software determining whether the parameter value of the data to be accessed is expired includes: the method comprises the steps of obtaining current time, traversing keys in data cache objects in an internal memory according to cache keys (keys), obtaining expiration time of a parameter value of data to be accessed, comparing the expiration time with the current time, and when the current time is greater than the expiration time, judging that the parameter value of the data to be accessed is expired, wherein the judgment result shows that the parameter value of the data to be accessed is expired, and video splicing software can clear the data cache object to which the parameter value of the data to be accessed belongs so as to release the internal memory occupied by the data cache object. When the current time is not greater than the expiration time, the judgment result is no, which indicates that the parameter value of the data to be accessed is not expired, and the parameter value of the data to be accessed may still be used, so that the video splicing software does not temporarily clean the data cache object to which the parameter value of the data to be accessed belongs, so as to facilitate subsequent access of the video splicing software, the video splicing software does not process the data cache object, continues to judge the next data cache object, and knows that all data cache objects are judged to be finished.
In addition, as shown in fig. 2B, after the parameter value of the data to be accessed is cached in the data cache object in the memory, before the video splicing software directly obtains the parameter value of the data to be accessed from the corresponding data cache object in the memory according to the cache key (key), it is necessary to determine whether the parameter value of the data to be accessed is expired, and the process of determining that the parameter value of the data to be accessed is expired is as described above, and is not described here again. When the parameter value of the data to be accessed is not expired, the video splicing software can directly acquire the parameter value of the data to be accessed for use. When the parameter value of the data to be accessed is expired, the video splicing software is indicated to be not ready to clean the data cache object, the video splicing software gives up reading the parameter value of the data to be accessed, and reads the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed again from the outside of the memory for use, so that the validity of the parameter value of the data to be accessed acquired by the video splicing software can be ensured, and the stability is improved.
In summary, in the embodiments of the present invention, a unique cache key is generated according to a to-be-accessed data parameter whose parameter value needs to be read, and the to-be-accessed data parameter value of the to-be-accessed data parameter is cached to a data cache object in a memory through the cache key, so that the data cache object is directly read from the memory when the to-be-accessed data parameter is accessed again, which solves the problem of low data reading efficiency when the to-be-accessed data parameter value needs to be read from the outside every time in the prior art, and improves data access efficiency. In addition, determining expiration time and validity period for the parameter values of the data to be accessed, caching the parameter values correspondingly, monitoring whether the data cache objects are expired or not in real time, and timely and automatically cleaning the expired data cache objects when the data cache objects are expired so as to release the occupied memory of the data cache objects. Moreover, after the parameter value of the data to be accessed is cached in the data cache object in the memory, the video splicing software judges whether the parameter value of the data to be accessed is expired or not before directly acquiring the parameter value of the data to be accessed from the corresponding data cache object in the memory according to the cache key, and then acquires the parameter value of the data to be accessed for use, so that the validity of the parameter value of the data to be accessed acquired by the video splicing software can be ensured, and the stability is improved.
[ second embodiment ]
As shown in fig. 3A, a second embodiment of the present invention provides a data access apparatus 400. The data access device 400 includes, for example: the data reading system comprises a data parameter determining module 410, a cache key generating module 420, a first judging module 430, a first data reading module 440 and a second data reading module 450.
A data parameter determining module 410, configured to determine a data parameter to be accessed.
And the cache key generation module 420 is configured to generate a corresponding cache key according to the data parameter to be accessed.
The first determining module 430 is configured to determine whether the cache key is cached in a data cache object of the memory.
The first data reading module 440 is configured to, if the determination result is negative, read a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory, and correspondingly cache the cache key and the to-be-accessed data parameter value in the data cache object. In addition, the first data reading module is further configured to: determining the expiration time of the parameter value of the data to be accessed; and caching the expiration time corresponding to the parameter value of the data to be accessed.
And a second data reading module 450, configured to, when the determination result is yes, directly obtain, according to the cache key, a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter from the data cache object. Further, the second data reading module 450 is further configured to: and judging whether the parameter value of the data to be accessed is expired.
Further, as shown in fig. 3B, the data access apparatus 400 may further include: a second decision block 460 and a cache data removal block 470.
A second determining module 460, configured to determine whether the parameter value of the data to be accessed is expired. Specifically, the second determining module 460 is configured to: acquiring current time; traversing a data cache object in the memory according to the cache key to acquire expiration time corresponding to the parameter value of the data to be accessed; comparing the expiration time of the value of the data parameter to be accessed with the current time; and when the current time is greater than the expiration time, the judgment result is yes, otherwise, the judgment result is no.
A cache data removing module 470, configured to remove, when the determination result is yes, the data cache object to which the parameter value of the data to be accessed belongs from the memory.
For specific working processes and technical effects among the modules in the data access apparatus 400 in this embodiment, reference is made to the description of the foregoing first embodiment, and details are not repeated here.
[ third embodiment ]
As shown in fig. 4, a third embodiment of the present invention provides a data access system 500. The data access system 500 includes, for example, a memory 510 and a processor 530 coupled to the memory 510. The memory 510 may be, for example, a non-volatile memory having stored thereon a computer program 511. Processor 530 may be, for example, an embedded processor. The processor 530, when running the computer program 511, performs the data access method in the foregoing first embodiment.
The specific operation and technical effects of the data access system 500 in the present embodiment are described with reference to the foregoing first embodiment.
[ fourth example ] A
As shown in fig. 5, a fourth embodiment of the present invention provides a storage medium, such as a computer-readable storage medium 600. The computer-readable storage medium 600 is, for example, a nonvolatile memory, which is, for example: magnetic media (e.g., hard disks, floppy disks, and magnetic tape), optical media (e.g., CDROM disks and DVDs), magneto-optical media (e.g., optical disks), and hardware devices specially constructed for storing and executing computer-executable instructions (e.g., Read Only Memories (ROMs), Random Access Memories (RAMs), flash memories, etc.). Computer-readable storage medium 600 has stored thereon computer-executable instructions 610. The computer-readable storage medium 600 may execute the computer-executable instructions 610 by one or more processors or processing devices to implement the data access method in the foregoing first embodiment.
In addition, it should be understood that the foregoing embodiments are merely exemplary illustrations of the present invention, and the technical solutions of the embodiments can be arbitrarily combined and collocated without conflict between technical features and structural contradictions, which do not violate the purpose of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit is merely a division of one logic function, and an actual implementation may have another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may also be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method of data access, comprising:
determining parameters of data to be accessed;
generating a corresponding cache key according to the data parameter to be accessed;
judging whether the cache key is cached in a data cache object of an internal memory;
when the judgment result is negative, reading a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory, and correspondingly caching the cache key and the to-be-accessed data parameter value into a data cache object in the memory;
and when the judgment result is yes, directly acquiring the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key.
2. The data access method according to claim 1, further comprising, after the correspondingly caching the cache key and the parameter value of the data to be accessed in the data cache object in the memory:
determining the expiration time of the parameter value of the data to be accessed; and
and caching the expiration time corresponding to the parameter value of the data to be accessed.
3. The data access method of claim 2, further comprising:
judging whether the parameter value of the data to be accessed is overdue or not;
and when the judgment result is yes, removing the data cache object to which the parameter value of the data to be accessed belongs from the memory.
4. The data access method of claim 3, wherein the determining whether the value of the data parameter to be accessed is expired comprises:
acquiring current time;
traversing a data cache object in the memory according to the cache key to acquire expiration time corresponding to the parameter value of the data to be accessed;
comparing the expiration time of the value of the data parameter to be accessed with the current time;
and when the current time is greater than the expiration time, the judgment result is yes, otherwise, the judgment result is no.
5. The data access method according to claim 2, before the directly obtaining the value of the data parameter to be accessed corresponding to the data parameter to be accessed from the data cache object according to the cache key, further comprising:
and judging whether the parameter value of the data to be accessed is expired.
6. A data access device, comprising:
the data parameter determining module is used for determining the parameters of the data to be accessed;
the cache key generation module is used for generating a corresponding cache key according to the data parameter to be accessed;
the first judgment module is used for judging whether the cache key is cached in a data cache object of the memory;
the first data reading module is used for reading a to-be-accessed data parameter value corresponding to the to-be-accessed data parameter outside the memory and correspondingly caching the cache key and the to-be-accessed data parameter value into a data cache object in the memory when the judgment result is negative; and
and the second data reading module is used for directly acquiring the parameter value of the data to be accessed corresponding to the parameter of the data to be accessed from the data cache object according to the cache key when the judgment result is yes.
7. The data access device of claim 6, wherein the first data reading module is further to:
determining the expiration time of the parameter value of the data to be accessed; and
and caching the expiration time corresponding to the parameter value of the data to be accessed.
8. The data access method of claim 7, further comprising:
the second judgment module is used for judging whether the parameter value of the data to be accessed is overdue or not;
and the cache data removing module is used for removing the data cache object to which the parameter value of the data to be accessed belongs from the memory when the judgment result is yes.
9. The data access device of claim 8, wherein the second determination module is specifically configured to:
acquiring current time;
comparing the expiration time of the value of the data parameter to be accessed with the current time;
traversing a data cache object in the memory according to the cache key to acquire expiration time corresponding to the parameter value of the data to be accessed;
and when the current time is greater than the expiration time, the judgment result is yes, otherwise, the judgment result is no.
10. The data access device of claim 7, wherein the second data reading module is further to:
and judging whether the parameter value of the data to be accessed is expired.
CN201911160536.9A 2019-11-23 2019-11-23 Data access method and device Pending CN112835819A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911160536.9A CN112835819A (en) 2019-11-23 2019-11-23 Data access method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911160536.9A CN112835819A (en) 2019-11-23 2019-11-23 Data access method and device

Publications (1)

Publication Number Publication Date
CN112835819A true CN112835819A (en) 2021-05-25

Family

ID=75921844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911160536.9A Pending CN112835819A (en) 2019-11-23 2019-11-23 Data access method and device

Country Status (1)

Country Link
CN (1) CN112835819A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150178328A1 (en) * 2013-12-23 2015-06-25 Dean Emerson Stephan, III Client-Side Directed Commands to a Loosely Coupled Database
CN105306457A (en) * 2015-09-30 2016-02-03 努比亚技术有限公司 Data caching device and method
CN106815287A (en) * 2016-12-06 2017-06-09 中国银联股份有限公司 A kind of buffer memory management method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150178328A1 (en) * 2013-12-23 2015-06-25 Dean Emerson Stephan, III Client-Side Directed Commands to a Loosely Coupled Database
CN105306457A (en) * 2015-09-30 2016-02-03 努比亚技术有限公司 Data caching device and method
CN106815287A (en) * 2016-12-06 2017-06-09 中国银联股份有限公司 A kind of buffer memory management method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王彦士等: "支持透明集成的数据缓存机制", 《计算机研究与发展》 *
韩兵等: "基于JDBC的数据访问优化技术", 《计算机工程与设计》 *

Similar Documents

Publication Publication Date Title
WO2016141735A1 (en) Cache data determination method and device
CN104778778B (en) A kind of banknote detection method and system
CN108711025B (en) Car rental vehicle inventory query method and device, electronic equipment and storage medium
CN111291018B (en) Data management method, device, equipment and storage medium
CN115827162A (en) Method, device, medium and equipment for intelligently processing mirror image warehouse data
CN112328602B (en) Method, device and equipment for writing data into Kafka
CN114138756B (en) Data deduplication method, node and computer-readable storage medium
CN114281819A (en) Data query method, device, equipment and storage medium
CN112835819A (en) Data access method and device
CN111414528B (en) Method and device for determining equipment identification, storage medium and electronic equipment
CN109286532B (en) Management method and device for alarm information in cloud computing system
CN112346848A (en) Method, device and terminal for managing memory pool
CN107193721B (en) Method and device for generating log
CN110471764A (en) A kind of processing method and processing device of memory cleaning
CN115934999A (en) Video stream data storage method, device and medium based on block file
CN107291777A (en) A kind of method and apparatus of hot spot data identification and processing
CN107315806B (en) Embedded storage method and device based on file system
CN113905014B (en) Method, server and storage medium for assigning ID number to terminal device
CN115756955A (en) Data backup and data recovery method and device and computer equipment
CN109460284B (en) Method and system for executing change to virtual machine
CN114861003A (en) Object enumeration method, device and medium under specified directory
CN109542806B (en) Bus data analysis method, device and storage medium
CN115081233B (en) Flow simulation method and electronic equipment
CN107357722B (en) Social Network Service (SNS) testing system and method based on a large number of testing users
CN104239182A (en) Cluster file system split-brain processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210525