CN107784073B - Data query method for local cache, storage medium and server - Google Patents

Data query method for local cache, storage medium and server Download PDF

Info

Publication number
CN107784073B
CN107784073B CN201710858932.3A CN201710858932A CN107784073B CN 107784073 B CN107784073 B CN 107784073B CN 201710858932 A CN201710858932 A CN 201710858932A CN 107784073 B CN107784073 B CN 107784073B
Authority
CN
China
Prior art keywords
data
local cache
acquiring
hierarchy
level
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.)
Active
Application number
CN201710858932.3A
Other languages
Chinese (zh)
Other versions
CN107784073A (en
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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China 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 Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN201710858932.3A priority Critical patent/CN107784073B/en
Publication of CN107784073A publication Critical patent/CN107784073A/en
Application granted granted Critical
Publication of CN107784073B publication Critical patent/CN107784073B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Abstract

The invention discloses a data query method of local cache, which is used for solving the problems of how to perform local cache and fast index of data. The method provided by the invention comprises the following steps: acquiring target data to be inquired; performing hash code conversion on the target data to obtain a first index code; performing hash code comparison on the first index code and data of each level in a local cache; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode; acquiring first data successfully compared with the hash codes; acquiring all lower-layer data of the first data in the local cache as a query result of the target data; and outputting the query result. The invention also provides a storage medium and a server.

Description

Data query method for local cache, storage medium and server
Technical Field
The invention relates to the technical field of data storage, in particular to a data query method of local cache, a storage medium and a server.
Background
In general system architecture, there is usually only one database, and the application server interfacing with the database can be infinitely extended. In order to reduce the pressure of the database, some basic data are usually put on the application server for local caching, so how to perform local caching and fast indexing of the data becomes a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
The embodiment of the invention provides a data query method of local cache, a storage medium and a server, which can save the memory occupied by the data cache, improve the traversal speed when querying data and reduce the consumption of a CPU.
In a first aspect, a method for querying data cached locally is provided, including:
acquiring target data to be inquired;
performing hash code conversion on the target data to obtain a first index code;
performing hash code comparison on the first index code and data of each level in a local cache; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode;
acquiring first data successfully compared with the hash codes;
acquiring all lower-layer data of the first data in the local cache as a query result of the target data;
and outputting the query result.
In a second aspect, a computer-readable storage medium is provided, which stores a computer program, which when executed by a processor implements the steps of the above-mentioned locally cached data querying method.
In a third aspect, a server is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program:
acquiring target data to be inquired;
performing hash code conversion on the target data to obtain a first index code;
performing hash code comparison on the first index code and data of each level in a local cache; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode;
acquiring first data successfully compared with the hash codes;
acquiring all lower-layer data of the first data in the local cache as a query result of the target data;
and outputting the query result.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the embodiment of the invention, firstly, target data to be inquired is obtained; then, performing hash code conversion on the target data to obtain a first index code; then, the first index code is compared with the data of each level in the local cache by a Hash code; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode; acquiring first data successfully compared with the hash codes; then, all lower-layer data of the first data in the local cache are obtained as a query result of the target data; and finally, outputting the query result. Therefore, the local cache adopts a key-value structure to store data of the same level, and compared with the prior art, the local cache can save the occupation of a memory; moreover, the query index is carried out by adopting a hash code comparison mode, and the query speed of the hash code is very high, so that the traversal speed in the data query process can be improved, and the consumption of a CPU (Central processing Unit) is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described 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 inventive exercise.
Fig. 1 is a flowchart of an embodiment of a data query method for a local cache according to the present invention;
fig. 2 is a schematic flow chart illustrating a method for querying data cached locally pre-storing data of each hierarchy in an application scenario according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of step 203 of the data query method for local cache in the embodiment corresponding to fig. 2 in an application scenario;
fig. 4 is a schematic flowchart of a step 105 of the data query method for local cache in the embodiment corresponding to fig. 3 in an application scenario;
fig. 5 is a structural diagram of an embodiment of a data query device for local cache according to the present invention;
fig. 6 is a schematic diagram of a server according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a data query method of local cache, a storage medium and a server, which are used for solving the problems of how to perform local cache and fast index of data.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below 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.
Referring to fig. 1, an embodiment of a method for querying data of a local cache according to the present invention includes:
101. acquiring target data to be inquired;
in this embodiment, when data to be locally cached needs to be queried, the current data to be queried needs to be determined first and is recorded as target data. For example, if city data of each province across the country is stored in the local cache, and the current city data of each province in Guangdong province needs to be queried, it may be determined that "Guangdong province" is the target data.
102. Performing hash code conversion on the target data to obtain a first index code;
after the target data is determined, in order to improve the speed of data indexing in the local cache, hash code comparison is adopted during query, so that hash code conversion needs to be performed on the target data to obtain a first index code in a hash code format.
103. Performing hash code comparison on the first index code and data of each level in a local cache;
first, it should be noted that, in a local cache, data of each hierarchy is stored in the local cache in a key-value storage structure, both a key and a value in the same key-value storage structure are used for storing data of the same hierarchy, and a top-bottom relationship between upper layer data and lower layer data is established between data of different hierarchies in a pointer reference manner. The key-value storage structure may be a HashMap storage structure, or a convurrenthashmap storage structure.
For example, a ConcurrentHashMap storage structure is used, and it is assumed that city data of each province of the whole country is stored in a local cache, wherein the province data is upper-layer data, and the city data corresponding to the province is lower-layer data. For example, "Guangdong province" and "Hunan province" are upper layer data, and the city data of "Guangzhou" and "Shenzhen" in "Guangdong province" are lower layer data belonging to "Guangdong province". For provincial Data and city Data, DTO (Data transfer object) can be adopted for respective encapsulation, where the DTO encapsulating the provincial Data is denoted as providencetdo and the DTO encapsulating the city Data is denoted as city DTO. ProvincetDTO can be packaged with province names, and CityDTO can be packaged with city data such as city codes, city names, provinces and postcodes.
In this embodiment, both key and value in the same consturrenthashmap < key, value > are used for storing data of the same hierarchy, and therefore, when upper layer data is stored, both the key and value are providencedo, that is, two provinces of data are written into the same consturrenthashmap storage structure, that is, consturrenthashmap < providencedo, providencedo >. Similarly, when storing the lower layer data, the key and value are both citydo, that is, two city data are written into the same ConcurrentHashMap storage structure, that is, ConcurrentHashMap < citydo, citydo >.
Specifically, as shown in fig. 2, the data of each level in the local cache may be pre-stored by the following steps:
201. acquiring data of each level to be stored in a local cache;
202. respectively writing the data of the same hierarchy in the data of each hierarchy into each key-value storage structure, wherein the key and the value in the same key-value storage structure respectively store one data;
203. after the data of each hierarchy is written, establishing a pointer reference relationship between upper layer data and lower layer data in the data of each hierarchy.
For step 201, when the data is stored in the local cache in advance, the data of each hierarchy, such as the province data and the city data in the above example, is obtained first.
With respect to step 202 above, it can be appreciated that two data are stored in the same key-value storage structure, and belong to the same hierarchy of data. For example, two province data may be written into one ConcurrentHashMap storage structure, and two city data may be written into the same ConcurrentHashMap storage structure. Therefore, in general, if there are n data in a certain hierarchy of data, n/2 ConcurrentHashMap storage structures are needed for storage.
For step 203, after the data of each hierarchy is written, a pointer reference relationship between upper layer data and lower layer data in the data of each hierarchy needs to be established, that is, an index relationship between the upper layer data and the lower layer data is established.
Further, as shown in fig. 3, the step 203 may include:
301. acquiring unique identifiers of all lower layer data belonging to the upper layer data;
302. storing all the acquired unique identifiers into a pointer array;
303. and writing the pointer array into the upper layer data.
With respect to step 301, it can be understood that, before establishing the index relationship between the upper layer data and the lower layer data, it is necessary to determine which lower layer data the upper layer data has. For example, the province data of Guangdong province includes cities such as Guangzhou, Shenzhen and Zhuhai … …, and the city data all belong to the province data of Guangdong province. After all the lower layer data are determined, the unique identification of the lower layer data is acquired. In actual use, the hash code conversion can be performed on the lower layer data to obtain the hash code corresponding to the lower layer data, and the hash code has uniqueness, so that the hash code can be used as a unique identifier of the lower layer data. Moreover, the hash codes are convenient to compare when the data is inquired subsequently.
With respect to step 302, it can be understood that, for all lower layer data under the same upper layer data, the unique identifiers of these lower layer data can be stored in a pointer array. Specifically, the pointer data may be a List storage structure. For example, when storing the unique identifiers of all the city data in the province data of Guangdong province, the unique identifiers of the city data may be written into the same List array, and then step 303 is executed to write the List array into ProvinceDTO of "Guangdong province". It can be known that after all the province data are written into the corresponding pointer arrays, the data index relationship of the tree structure between the established province data and the city data is represented.
It should be noted that, in the local cache, it is necessary to ensure that the hash codes corresponding to the upper layer data and the lower layer data have uniqueness, that is, the hash codes of any two data are different from each other.
In step 103, after obtaining the first index code, the first index code may be compared with the hash code of the data of each level in the local cache. It can be known that, if two hash codes are the same, the data corresponding to the two same hash codes are also the same, that is, the data that is the same as the target data is found in the local cache.
104. Acquiring first data successfully compared with the hash codes;
as can be seen from the above, if the hash code comparison is successful, it indicates that this data successfully compared is the same as the target data, and this embodiment marks this data as the first data.
105. Acquiring all lower-layer data of the first data in the local cache as a query result of the target data;
after first data which is the same as target data in a local cache is obtained, all lower-layer data under the first data can be obtained according to the index relationship among the data of each hierarchy, and the obtained lower-layer data are the query result of the query. For example, for the example of receiving the province data and the city data, when the target data is "guangdong province", the first data "guangdong province" in the local cache is queried, and then city data under guangdong province, including city data of a plurality of cities such as "guangzhou", "shenzhen", "zhuyi" … …, are obtained, and the city data are the query result for "guangdong province" this time.
Further, as shown in fig. 4, when all lower layer data of the first data are acquired in step 105, if the index relationship between the upper layer data and the lower layer data is established by a pointer array, step 105 may specifically include:
401. acquiring a first pointer array in the first data;
402. acquiring all unique identifiers stored in the first pointer array;
403. determining all lower-layer data of the first data according to all unique identifiers in the first pointer array;
404. and acquiring the determined lower layer data from the local cache as a query result of the target data.
As for the above steps 401 to 404, it can be understood from the contents of the above steps 301 to 303 that the acquired first data includes the pointer array, i.e. the above first pointer array. The unique identifiers of all lower-layer data of the first data are stored in the first pointer array, so that all lower-layer data of the first data can be determined according to the unique identifiers in the first pointer array. Specifically, when the hash code is used as the unique identifier, step 402 obtains the hash codes of all lower layer data in the first array, and then the corresponding lower layer data can be found from the local cache by comparing the hash codes as the query result of this time.
106. And outputting the query result.
After the query result is obtained in step 105, the query result may be output. The output mode may be to display the query result on a display, or send the query result to the user through a short message, an email, or the like, which is not limited in this embodiment.
Compared with the prior art, the data query method of the local cache in the embodiment can reduce the memory occupation required by data storage and improve the memory utilization rate. This is because, in the prior art, when the key-value storage structures are used to store data, one data is stored in the value, and the key value is used to store the unique key of the data, which results in that each key-value storage structure is only used to store one data, and especially when the key value is the joint unique key, the memory occupied amount of each storage structure is large. In the key-value storage structure adopted by the local cache in the embodiment, each key-value storage structure can store two data without storing a unique key, so that the memory occupation required by data storage is greatly reduced.
On the other hand, in the key-value storage structure in the prior art, when data is queried, the data needs to be screened by traversing the full cache through the unique key in the key value, so that the query performance is poor, and the resource consumption of the CPU is high. In the embodiment, the query index is performed by adopting a hash code comparison mode, and the query speed of the hash code is high, so that the traversal speed of data can be increased, and the consumption of a CPU (central processing unit) can be reduced.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
The above mainly describes a data query method for a local cache, and a data query apparatus for a local cache is described in detail below.
Fig. 5 is a block diagram illustrating an embodiment of a data query apparatus for local cache according to an embodiment of the present invention.
In this embodiment, a data query apparatus for local cache includes:
a target data obtaining module 501, configured to obtain target data to be queried;
a hash code conversion module 502, configured to perform hash code conversion on the target data to obtain a first index code;
a hash code comparison module 503, configured to perform hash code comparison on the first index code and data of each level in the local cache; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode;
a first data obtaining module 504, configured to obtain first data with successfully compared hash codes;
a query result obtaining module 505, configured to obtain all lower-layer data of the first data in the local cache as a query result of the target data;
and a query result output module 506, configured to output the query result.
Further, the data of each hierarchy in the local cache may be pre-stored by:
the hierarchy data acquisition module is used for acquiring data of each hierarchy to be stored in the local cache;
the data writing module is used for respectively writing the data of the same hierarchy in the data of each hierarchy into each key-value storage structure, and the key and the value in the same key-value storage structure respectively store one piece of data;
and the upper-lower layer relation establishing module is used for establishing a pointer reference relation between upper-layer data and lower-layer data in the data of each hierarchy after the data of each hierarchy is written.
Further, the upper and lower layer relationship establishing module may include:
the unique identification acquisition unit is used for acquiring unique identifications of all lower layer data belonging to the upper layer data;
the identifier storage unit is used for storing all the acquired unique identifiers into a pointer array;
and the array writing unit is used for writing the pointer array into the upper layer data.
Further, the query result obtaining module may include:
the pointer array obtaining unit is used for obtaining a first pointer array in the first data;
the array identifier acquisition unit is used for acquiring all unique identifiers stored in the first pointer array;
the lower layer data determining unit is used for determining all lower layer data of the first data according to all unique identifiers in the first pointer array;
and the query result determining unit is used for acquiring the determined lower layer data from the local cache as the query result of the target data.
Further, the key-value storage structure may be a ConcurrentHashMap storage structure.
Fig. 6 is a schematic diagram of a server according to an embodiment of the present invention. As shown in fig. 6, the server 6 of this embodiment includes: a processor 60, a memory 61 and a computer program 62 stored in said memory 61 and operable on said processor 60, such as a program performing the above-mentioned locally cached data querying method. The processor 60, when executing the computer program 62, implements the steps in the above-described embodiments of the locally cached data querying method, such as the steps 101 to 106 shown in fig. 1. Alternatively, the processor 60, when executing the computer program 62, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the modules 501 to 506 shown in fig. 5.
Illustratively, the computer program 62 may be partitioned into one or more modules/units that are stored in the memory 61 and executed by the processor 60 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 62 in the server 6.
The server 6 may be a local server, a cloud server, or other computing device. The server may include, but is not limited to, a processor 60, a memory 61. Those skilled in the art will appreciate that fig. 6 is merely an example of a server 6 and does not constitute a limitation of the server 6, and may include more or fewer components than shown, or some components in combination, or different components, e.g., the server may also include input output devices, network access devices, buses, etc.
The Processor 60 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may be an internal storage unit of the server 6, such as a hard disk or a memory of the server 6. The memory 61 may also be an external storage device of the server 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) and the like provided on the server 6. Further, the memory 61 may also include both an internal storage unit of the server 6 and an external storage device. The memory 61 is used for storing the computer program and other programs and data required by the server. The memory 61 may also be used to temporarily store data that has been output or is to be output.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; 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 data query method of a local cache is characterized by comprising the following steps:
acquiring target data to be inquired;
performing hash code conversion on the target data to obtain a first index code;
performing hash code comparison on the first index code and data of each level in a local cache; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode;
acquiring first data successfully compared with the hash codes;
acquiring all lower-layer data of the first data in the local cache as a query result of the target data; the first data comprises a first pointer array, and all lower-layer data under the first data are determined according to the first pointer array;
and outputting the query result.
2. The method for querying data in a local cache according to claim 1, wherein the data in each level in the local cache is pre-stored by:
acquiring data of each level to be stored in a local cache;
respectively writing the data of the same hierarchy in the data of each hierarchy into each key-value storage structure, wherein the key and the value in the same key-value storage structure respectively store one data;
after the data of each hierarchy is written, establishing a pointer reference relationship between upper layer data and lower layer data in the data of each hierarchy.
3. The method according to claim 2, wherein the establishing of the pointer reference relationship between the upper layer data and the lower layer data in the data of each hierarchy comprises:
acquiring unique identifiers of all lower layer data belonging to the upper layer data;
storing all the acquired unique identifiers into a pointer array;
and writing the pointer array into the upper layer data.
4. The method according to claim 3, wherein the obtaining all lower layer data of the first data in the local cache as the query result of the target data comprises:
acquiring a first pointer array in the first data;
acquiring all unique identifiers stored in the first pointer array;
determining all lower-layer data of the first data according to all unique identifiers in the first pointer array;
and acquiring the determined lower layer data from the local cache as a query result of the target data.
5. The locally cached data query method according to any one of claims 1 to 4, wherein the key-value storage structure is a HashMap storage structure, or the key-value storage structure is a ConcurrentHashMap storage structure.
6. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the locally cached data query method according to any one of claims 1 to 5.
7. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor when executing the computer program implements the steps of:
acquiring target data to be inquired;
performing hash code conversion on the target data to obtain a first index code;
performing hash code comparison on the first index code and data of each level in a local cache; the data of each hierarchy is stored in the local cache in a key-value storage structure, keys and values in the same key-value storage structure are used for storing the data of the same hierarchy, and the upper-level and lower-level relations between upper-level data and lower-level data are established between the data of different hierarchies in a pointer reference mode;
acquiring first data successfully compared with the hash codes;
acquiring all lower-layer data of the first data in the local cache as a query result of the target data; the first data comprises a first pointer array, and all lower-layer data under the first data are determined according to the first pointer array;
and outputting the query result.
8. The server according to claim 7, wherein the data of each hierarchy in the local cache is pre-stored by:
acquiring data of each level to be stored in a local cache;
respectively writing the data of the same hierarchy in the data of each hierarchy into each key-value storage structure, wherein the key and the value in the same key-value storage structure respectively store one data;
after the data of each hierarchy is written, establishing a pointer reference relationship between upper layer data and lower layer data in the data of each hierarchy.
9. The server according to claim 8, wherein the establishing of the pointer reference relationship between the upper layer data and the lower layer data in the data of the respective hierarchies comprises:
acquiring unique identifiers of all lower layer data belonging to the upper layer data;
storing all the acquired unique identifiers into a pointer array;
and writing the pointer array into the upper layer data.
10. The server according to claim 9, wherein the obtaining all lower-layer data of the first data in the local cache as the query result of the target data comprises:
acquiring a first pointer array in the first data;
acquiring all unique identifiers stored in the first pointer array;
determining all lower-layer data of the first data according to all unique identifiers in the first pointer array;
and acquiring the determined lower layer data from the local cache as a query result of the target data.
CN201710858932.3A 2017-09-21 2017-09-21 Data query method for local cache, storage medium and server Active CN107784073B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710858932.3A CN107784073B (en) 2017-09-21 2017-09-21 Data query method for local cache, storage medium and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710858932.3A CN107784073B (en) 2017-09-21 2017-09-21 Data query method for local cache, storage medium and server

Publications (2)

Publication Number Publication Date
CN107784073A CN107784073A (en) 2018-03-09
CN107784073B true CN107784073B (en) 2020-03-27

Family

ID=61433513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710858932.3A Active CN107784073B (en) 2017-09-21 2017-09-21 Data query method for local cache, storage medium and server

Country Status (1)

Country Link
CN (1) CN107784073B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109739885A (en) * 2018-12-12 2019-05-10 平安科技(深圳)有限公司 Data query method, apparatus, equipment and storage medium based on local cache
CN112395440A (en) * 2020-11-24 2021-02-23 华中科技大学 Caching method, efficient image semantic retrieval method and system
CN112966008B (en) * 2021-04-12 2023-12-05 中国人民银行数字货币研究所 Data caching method, loading method, updating method and related devices
CN113420050B (en) * 2021-06-28 2023-08-25 深圳华科讯通科技有限公司 Data query management method, device, computer equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968507A (en) * 2012-12-14 2013-03-13 中国银行股份有限公司 Cache table based data query method
CN105320775A (en) * 2015-11-11 2016-02-10 中科曙光信息技术无锡有限公司 Data access method and apparatus
CN106484734A (en) * 2015-09-01 2017-03-08 天脉聚源(北京)科技有限公司 A kind of data query caching method and system
CN106599199A (en) * 2016-12-14 2017-04-26 国云科技股份有限公司 Data caching and synchronization method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102789427B (en) * 2012-07-17 2015-11-25 威盛电子股份有限公司 Data memory device and its method of operating

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968507A (en) * 2012-12-14 2013-03-13 中国银行股份有限公司 Cache table based data query method
CN106484734A (en) * 2015-09-01 2017-03-08 天脉聚源(北京)科技有限公司 A kind of data query caching method and system
CN105320775A (en) * 2015-11-11 2016-02-10 中科曙光信息技术无锡有限公司 Data access method and apparatus
CN106599199A (en) * 2016-12-14 2017-04-26 国云科技股份有限公司 Data caching and synchronization method

Also Published As

Publication number Publication date
CN107784073A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
CN108769111B (en) Server connection method, computer readable storage medium and terminal device
CN107784073B (en) Data query method for local cache, storage medium and server
AU2016382908B2 (en) Short link processing method, device and server
KR102097881B1 (en) Method and apparatus for processing a short link, and a short link server
KR101994021B1 (en) File manipulation method and apparatus
CN109597822B (en) User data storage and query method and user data processing device
CN107977396B (en) Method and device for updating data table of KeyValue database
TW201800967A (en) Method and device for processing distributed streaming data
CN108228799B (en) Object index information storage method and device
CN110489405B (en) Data processing method, device and server
CN111355816B (en) Server selection method, device, equipment and distributed service system
CN106326309A (en) Data query method and device
CN111767143A (en) Transaction data processing method, device, equipment and system
CN110727702B (en) Data query method, device, terminal and computer readable storage medium
CN108140050A (en) A kind of method and device using Bloom filter filtering file
CN105740405B (en) Method and device for storing data
CN104423982A (en) Request processing method and device
US9639566B2 (en) Method, apparatus and computer program product for improved storage of key-value pairs
CN107391541B (en) Real-time data merging method and device
CN105511814A (en) Storage method of static data file
CN111046106A (en) Cache data synchronization method, device, equipment and medium
CN111402958A (en) Method, system, equipment and medium for establishing gene comparison table
CN111352993A (en) Cross-platform data synchronization method and device and electronic equipment
CN108984615B (en) Data query method and system and storage medium
CN113032820A (en) File storage method, access method, device, equipment and storage medium

Legal Events

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