CN111831915A - Method, device, electronic equipment and storage medium for responding to data query request - Google Patents

Method, device, electronic equipment and storage medium for responding to data query request Download PDF

Info

Publication number
CN111831915A
CN111831915A CN202010717256.XA CN202010717256A CN111831915A CN 111831915 A CN111831915 A CN 111831915A CN 202010717256 A CN202010717256 A CN 202010717256A CN 111831915 A CN111831915 A CN 111831915A
Authority
CN
China
Prior art keywords
object data
target
data
version number
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
CN202010717256.XA
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010717256.XA priority Critical patent/CN111831915A/en
Publication of CN111831915A publication Critical patent/CN111831915A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation

Landscapes

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

Abstract

The embodiment of the invention provides a method and a device for responding to a data query request, electronic equipment and a storage medium. The method for responding to the data query request comprises the following steps: acquiring a data query request, wherein the data query request carries a target key value and a target version number; searching unexpired target object data with target version numbers and key values as target key values in a cache; if the target object data is found, request response aiming at the data query request is carried out based on the target object data; if the key value is not found, first object data with the key value as the target key value is obtained from the database; and performing request response aiming at the data query request based on the first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain second object data, and storing the second object data into the cache. The scheme solves the problem that the existing mode of updating the object with the changed attribute to the cache can not enable the object with the changed attribute to take effect in time and influence the online service.

Description

Method, device, electronic equipment and storage medium for responding to data query request
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method and an apparatus for responding to a data query request, an electronic device, and a storage medium.
Background
At present, the cache middleware generally supports a developer to set a cache validity period, and data is always stored in the cache in the validity period. The data in the cache may be an object with an attribute. For any object, the attribute of the object can be changed based on business requirements, namely, adding a new attribute, deleting some attributes or changing the attribute value of some attribute.
When the attribute of an object in a database is changed, in the prior art, the update mode of the corresponding object in the cache is as follows: and after waiting for the object data of the corresponding object in the cache to be over, the cache middleware extracts the object data of the corresponding object from the database and updates the extracted object data into the cache.
In the prior art, the object data of the object with the changed attribute in the database can be updated into the cache only after the object data of the object is expired, so that the object with the changed attribute cannot take effect in time, and online service is affected.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, an electronic device, and a storage medium for responding to a data query request, so as to solve the problem that an existing method for updating an attribute-modified object to a cache cannot enable the attribute-modified object to take effect in time, which affects an online service. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, a method for responding to a data query request is first provided, where the method is applied to a cache middleware, where object data stored in a cache has a version number, and the method includes:
acquiring a data query request sent by a data request terminal, wherein the data query request carries a target key value and a target version number;
searching unexpired target object data with the target version number and key values as the target key values in a cache;
if the target object data is found, performing request response aiming at the data query request based on the found target object data;
if not, obtaining first object data with the key value as the target key value from a database corresponding to the cache; and performing request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache.
Optionally, the splicing the first object data and the target version number according to a predetermined splicing manner to obtain spliced second object data includes:
respectively carrying out serialization processing on the first object data and the target version number;
and splicing the first object data after the serialization processing and the target version number to obtain spliced second object data.
Optionally, the splicing the first object data after the serialization processing and the target version number to obtain spliced second object data includes:
and splicing the target version number after the serialization processing to the tail part of the first object data after the serialization processing to obtain spliced second object data.
Optionally, the performing a request response for the data query request based on the found target object data includes:
removing the target version number spliced in the target object data from the searched target object data to obtain object data with the version number removed;
and utilizing the object data with the version number removed to perform request response aiming at the data query request.
In a second aspect of the embodiments of the present invention, there is further provided an apparatus for responding to a data query request, which is applied to cache middleware, where object data stored in a cache has a version number, and the apparatus includes:
the request acquisition module is used for acquiring a data query request sent by a data request terminal, wherein the data query request carries a target key value and a target version number;
the object searching module is used for searching unexpired target object data with the target version number and key values as the target key values in a cache;
a request response module, configured to perform a request response for the data query request based on the searched target object data when the target object data is found by the object search module;
the object obtaining module is used for obtaining first object data with a key value as the target key value from a database corresponding to the cache when the target object data is not found by the object searching module;
and the splicing updating module is used for carrying out request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache.
Optionally, the splicing update module is specifically configured to perform serialization processing on the first object data and the target version number respectively;
and splicing the first object data after the serialization processing and the target version number to obtain spliced second object data.
Optionally, the splicing update module is specifically configured to splice the serialized target version number to the tail of the serialized first object data, so as to obtain spliced second object data.
Optionally, the request response module is specifically configured to remove the target version number spliced in the target object data from the found target object data, so as to obtain object data with the version number removed;
and utilizing the object data with the version number removed to perform request response aiming at the data query request.
In another aspect of the embodiments of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor configured to implement the method steps of the first aspect when executing the program stored in the memory.
In a further aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps of the first aspect.
In the scheme provided by the embodiment of the invention, after a data query request which is sent by a data request end and comprises a target key value and a target version number is obtained, unexpired target object data with the target version number and the key value as the target key value are searched in a cache, if the unexpired target object data is searched, a request response aiming at the data query request is carried out based on the searched target object data, and if the unexpired target object data is not searched, first object data with the key value as the target key value is obtained from a database corresponding to the cache; and performing request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache. In the scheme, the object data in the cache is added with a version number, and the version number is used for distinguishing whether the attribute of the object is changed. Therefore, in the response process of the data query request, the target key value and the target version number are used as the search basis, when the attribute of the queried object is not changed, the object data which accords with the search basis can be searched in the cache for feedback, when the attribute of the queried object is changed, the object data which accords with the search basis cannot be queried in the cache, at the moment, the object data with the target key value can be obtained from the database for feedback, and meanwhile, the object with the changed attribute is updated into the cache by using the target version number, so that the object with the changed attribute can be ensured to be effective in time when being requested. Therefore, the scheme effectively solves the problem that the existing mode of updating the object with the changed attribute to the cache can not enable the object with the changed attribute to take effect in time and influence the online service.
In addition, in the scheme of the embodiment of the present invention, whether the object data in the cache is updated is related to the data query request, and only the object data requested by the data query request is subjected to the judgment of whether the object data is updated or not and is further updated when the judgment is yes; for the object data which is not requested, the object data does not need to be updated because the object data is not used currently, and the object data is waited for to be expired. Therefore, the embodiment of the invention can avoid the problems of overlarge update data volume and time consumption caused by updating the cache in full quantity based on the local update mode of the data query request.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of a method for responding to a data query request according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of cache data corresponding to a user id in the embodiment of the present invention;
fig. 3 is a block diagram of a method for responding to a data query request according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus for responding to a data query request according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following describes a technical solution of an embodiment of the present invention with reference to the drawings in the embodiment of the present invention.
In order to solve the problem that the existing mode of updating the object with the changed attribute to the cache cannot enable the object with the changed attribute to take effect in time and influence the online service, the embodiment of the invention provides a method and a device for responding a data query request, electronic equipment and a storage medium.
First, a method for responding to a data query request according to an embodiment of the present invention is described below.
The embodiment of the invention provides a method for responding to a data query request, which is applied to cache middleware, wherein object data stored in a cache has a version number. Since the object data stored in the cache is set to have a version number, when data is updated into the cache, the updated data also has a version number. In addition, the object data stored in the underlying database corresponding to the cache does not have a version number, and the specific storage method is the same as that in the prior art.
It should be noted that the cache middleware is used to implement management on the cache, for example, provide an Application Programming Interface (API), provide a database loading data Interface, perform data processing when writing in the cache, and perform data processing when reading the cache. The detailed description of each specific operation supported by the cache middleware is provided in each step.
For the purpose of solution understanding, the processing idea of the method provided in the following embodiments of the present invention is first described. Specifically, the processing idea is as follows: adding a version number to object data in the cache, wherein the version number is used for distinguishing whether the attribute of the object is changed; in this way, in the response process of the data query request, the target key value and the target version number are used as the search basis, the object data which accords with the search basis is searched in the cache for feedback, when the object data is not searched, the object data with the target key value is obtained from the database for feedback, and meanwhile, the object with the modified attribute is updated into the cache by using the target version number, so that the object with the modified attribute can be timely effective when the object with the modified attribute is requested.
As shown in fig. 1, a method for responding to a data query request according to an embodiment of the present invention may include the following steps:
s101, a data query request sent by a data request end is obtained, wherein the data query request carries a target key value and a target version number.
It should be noted that the cache middleware provides a cache query API to the outside, and the interface signature may be a String get (String key, String version); the key is a target key value, and the version is a target version number.
For example, for a business for obtaining a user profile, the target key value may adopt ids of users, each id corresponds to a user profile, where the user profile may include information such as name, gender, age, and the like of the user. There are many coding modes of id, and a suitable coding mode can be selected according to actual needs in application. The version number is an identification number of the version and is used for distinguishing user data of different versions of the same user. For the same id, data query requests with different version numbers can be obtained, for example, a data query request with id of "11111" and target version number of "1.0.0" can be obtained; the data query request with id of "11111" and target version number of "1.0.1" may also be obtained. Since the coding of id and the naming format of version number both belong to the prior art, they are not described herein again.
It should be noted that the data request end may be an administrator debugging end or a data relay processing end. For the administrator debugging end, after the object data in the bottom database is updated, since the management debugging personnel know the target key value of the object data needing to be updated to the cache, the corresponding target version number can be compiled by self, and the target key value and the target version number are sent to the cache middleware. For the data relay processing end, the data relay processing end may be associated with the bottom database, and when the data relay processing end receives a target key value of the object data sent by the user client, if the data relay processing end knows that the object data in the bottom database is updated, a corresponding target version number is generated for the object data sent by the user client, and the target key value and the target version number are sent to the cache middleware.
After the cache middleware receives a data query request which is sent by a data request end and carries a target key value and a target version number, data query is carried out, whether data are loaded from a database or not can be determined subsequently according to a query result, the cache is updated, and the data are returned.
S102, searching unexpired target object data with the target version number and the key value as the target key value in a cache.
It should be noted that the cache middleware queries the target object data in the cache according to the target key value and the target version number, and performs different processing according to different data conditions searched in the cache. For example, a specific implementation manner of searching for unexpired target object data with the target version number and the key value as the target key value in the cache may include:
searching the object data with the target key value in a cache, and if the object data is not searched, directly judging that the undetected key value is the target key value and the unexpired target object data with the target version number is not searched;
if the target version number is found, continuously identifying whether the version number of the target data with the target key value is a target version number, and if the version number of the target data with the target key value is not the target version number, judging that the target data which is not found and has the target version number is not overdue and the key value is the target key value;
if the target version number is the target version number, judging whether the searched object data is overdue, and if the searched object data is not overdue, judging that the searched key value is the target key value and the target object data with the target version number is unexpired; otherwise, judging that the unexpired target object data with the target version number and the key value which is not found is the target key value.
The above specific implementation manner of searching for the unexpired target object data with the target version number and the key value as the target key value in the cache is merely an example, and should not be construed as a limitation to the embodiment of the present invention.
And S103, if the target object data is found, performing request response aiming at the data query request based on the found target object data.
If the unexpired target object data with the target key value and the target version number can be found in the cache according to the data query request which is sent by the data request end and carries the target key value and the target version number, the data can be directly returned by adopting a cache query API provided by the cache middleware.
For example, for a data query request with id "11111" and target version number "1.0.1", if there is a user profile that has corresponding id "11111", has target key value "1.0.1" and is not expired in the cache, the user profile is returned.
The performing a request response for the data query request based on the found target object data may specifically include:
step one, removing the target version number spliced in the target object data from the searched target object data to obtain object data with the version number removed;
and step two, utilizing the object data with the version number removed to perform request response aiming at the data query request.
It should be noted that, since the target object data stored in the cache has a version number, before returning the data, the cache middleware needs to analyze the data in the target object data from the cache, respectively. For example, if byte [ ] is used to store data in the cache, when target object data byte [ ] C is found in the cache, and the version information byte [ ] part with length n on the target object data byte [ ] C is removed, the object data byte [ ] a with the version number removed can be obtained, and a request response for a data query request can be performed by using the object data byte [ ] a.
In addition, the object data byte [ ] a that has been serialized at the time of updating the cache needs to be deserialized before returning the data. The deserialization is to reconstruct the object according to the object state and the description information stored in the byte stream after obtaining the serialized object byte stream. Since the deserialization belongs to the prior art, it is not described in detail here.
And S104, if the key value is not found, acquiring first object data with the key value as the target key value from the database corresponding to the cache.
If the unexpired target object data with the target version number and the key value as the target key value are not found in the cache, the operation of acquiring the data in the database is also executed.
It should be noted that the cache middleware may provide a database loading data interface, such as a load (string) interface; the interface is used for caching object data with key values as target key values when the key values do not exist in the cache; or the object data with the key value as the target key value exists in the cache but the object data is expired, or the object data with the key value as the target key value exists in the cache but the object data is not expired but the version number corresponding to the object data is not equal to the target version number, the data is loaded from the database.
And S105, based on the acquired first object data, performing a request response aiming at the data query request, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache.
It should be noted that, for a data query request, the cache query API provided by the cache middleware may return the first object data obtained from the database. When the first object data is returned, the target version number is spliced on the first object data to generate second object data, and the cache is updated by adopting the second object data.
The splicing the first object data and the target version number according to a predetermined splicing manner to obtain spliced second object data may specifically include:
step one, the first object data and the target version number are respectively serialized;
it is to be understood that the first object data and the target version number may be serialized in order to ensure persistence and transferability of the object. Serialization is the conversion of objects into an ordered byte stream, and is not described in detail herein since serialization is in the prior art.
And step two, splicing the first object data after the serialization processing and the target version number to obtain spliced second object data.
Specifically, the splicing the first object data after the serialization processing and the target version number to obtain spliced second object data may include:
and splicing the target version number after the serialization processing to the tail part of the first object data after the serialization processing to obtain spliced second object data.
For example, fig. 2 shows second object data obtained by stitching, where the name, gender, age, and address are first object data extracted from the database, and the target version number is stitched to the tail of the first object data to obtain the second object data for storing in the cache.
It is to be understood that the above splicing manner is only an example, and is not limited thereto, and other splicing manners may also be adopted; for example, the target version number may also be stitched to the head or middle of the first object, depending on the actual situation.
It should be noted that byte [ ] can be used in the cache to store data. When writing into the cache, the cache middleware may first convert the second object data and the target version number queried from the database into byte [ ] a and byte [ ] B, respectively, where the length of byte [ ] of the target version number is defined as n, and then concatenate byte [ ] B to byte [ ] a to form second object data byte [ ] C, and write into the cache.
Fig. 3 is a schematic diagram of a method for responding to a data query according to an embodiment of the present invention, where the method is performed in the order of arrows and numbers in the diagram. As shown in fig. 3, for a data query request with id "11111" and target version number "1.0.1", after the cache middleware obtains the data query request, i.e. get ("11111", "1.0.1"), if the cache misses (a miss means that there is no user data corresponding to id "11111" in the cache, or there is user data corresponding to id "11111" in the cache, but the user data is expired); or the cache is hit, but the version number corresponding to the user data is not equal to the target version number "1.0.1", for example, the key value corresponding to the user data in the cache is "1.0.0"; then the user profile with id "11111" is obtained from the database. After adding the target version number of 1.0.1 to the user data with the id of 11111, writing the user data into the cache and updating the data of the cache. And, the user profile with the user id "11111" acquired from the database is returned.
In the scheme provided by the embodiment of the invention, after a data query request which is sent by a data request end and comprises a target key value and a target version number is obtained, unexpired target object data with the target version number and the key value as the target key value are searched in a cache, if the unexpired target object data is searched, a request response aiming at the data query request is carried out based on the searched target object data, and if the unexpired target object data is not searched, first object data with the key value as the target key value is obtained from a database corresponding to the cache; and performing request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache. In the scheme, the object data in the cache is added with a version number, and the version number is used for distinguishing whether the attribute of the object is changed. Therefore, in the response process of the data query request, the target key value and the target version number are used as the search basis, when the attribute of the queried object is not changed, the object data which accords with the search basis can be searched in the cache for feedback, when the attribute of the queried object is changed, the object data which accords with the search basis cannot be queried in the cache, at the moment, the object data with the target key value can be obtained from the database for feedback, and meanwhile, the object with the changed attribute is updated into the cache by using the target version number, so that the object with the changed attribute can be ensured to be effective in time when being requested. Therefore, the scheme effectively solves the problem that the existing mode of updating the object with the changed attribute to the cache can not enable the object with the changed attribute to take effect in time and influence the online service.
In addition, in the scheme of the embodiment of the present invention, whether the object data in the cache is updated is related to the data query request, and only the object data requested by the data query request is subjected to the judgment of whether the object data is updated or not and is further updated when the judgment is yes; for the object data which is not requested, the object data does not need to be updated because the object data is not used currently, and the object data is waited for to be expired. Therefore, the embodiment of the invention can avoid the problems of overlarge update data volume and time consumption caused by updating the cache in full quantity based on the local update mode of the data query request.
As shown in fig. 4, an embodiment of the present invention further provides an apparatus for responding to a data query request, which is applied to cache middleware, where object data stored in a cache has a version number, and the apparatus includes:
a request obtaining module 401, configured to obtain a data query request sent by a data request end, where the data query request carries a target key value and a target version number;
an object search module 402, configured to search, in a cache, unexpired target object data whose key value is the target key value and has the target version number;
a request response module 403, configured to perform a request response for the data query request based on the searched target object data when the target object data is found by the object search module;
an object obtaining module 404, configured to, when the object searching module does not find the target object data, obtain first object data with a key value as the target key value from a database corresponding to the cache;
a splicing update module 405, configured to perform a request response for the data query request based on the obtained first object data, splice the first object data and the target version number according to a predetermined splicing manner to obtain spliced second object data, and store the second object data in the cache.
In the scheme provided by the embodiment of the invention, after a data query request which is sent by a data request end and comprises a target key value and a target version number is obtained, unexpired target object data with the target version number and the key value as the target key value are searched in a cache, if the unexpired target object data is searched, a request response aiming at the data query request is carried out based on the searched target object data, and if the unexpired target object data is not searched, first object data with the key value as the target key value is obtained from a database corresponding to the cache; and performing request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache. In the scheme, the object data in the cache is added with a version number, and the version number is used for distinguishing whether the attribute of the object is changed. Therefore, in the response process of the data query request, the target key value and the target version number are used as the search basis, when the attribute of the queried object is not changed, the object data which accords with the search basis can be searched in the cache for feedback, when the attribute of the queried object is changed, the object data which accords with the search basis cannot be queried in the cache, at the moment, the object data with the target key value can be obtained from the database for feedback, and meanwhile, the object with the changed attribute is updated into the cache by using the target version number, so that the object with the changed attribute can be ensured to be effective in time when being requested. Therefore, the scheme effectively solves the problem that the existing mode of updating the object with the changed attribute to the cache can not enable the object with the changed attribute to take effect in time and influence the online service.
Optionally, the splicing update module is specifically configured to perform serialization processing on the first object data and the target version number respectively;
and splicing the first object data after the serialization processing and the target version number to obtain spliced second object data.
Optionally, the splicing update module is specifically configured to splice the serialized target version number to the tail of the serialized first object data, so as to obtain spliced second object data.
Optionally, the request response module is specifically configured to remove the target version number spliced in the target object data from the found target object data, so as to obtain object data with the version number removed;
and utilizing the object data with the version number removed to perform request response aiming at the data query request.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501 is configured to implement the method for responding to a data query request in any of the above embodiments when executing the program stored in the memory 503.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the method for responding to a data query request in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for responding to a data query request, the method being applied to cache middleware, wherein object data stored in a cache has a version number, the method comprising:
acquiring a data query request sent by a data request terminal, wherein the data query request carries a target key value and a target version number;
searching unexpired target object data with the target version number and key values as the target key values in a cache;
if the target object data is found, performing request response aiming at the data query request based on the found target object data;
if not, obtaining first object data with the key value as the target key value from a database corresponding to the cache; and performing request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache.
2. The method of claim 1, wherein the splicing the first object data and the target version number according to a predetermined splicing manner to obtain spliced second object data comprises:
respectively carrying out serialization processing on the first object data and the target version number;
and splicing the first object data after the serialization processing and the target version number to obtain spliced second object data.
3. The method of claim 2, wherein the splicing the first object data after the serialization processing and the target version number to obtain second object data after the splicing comprises:
and splicing the target version number after the serialization processing to the tail part of the first object data after the serialization processing to obtain spliced second object data.
4. The method according to claim 1, wherein the performing a request response for the data query request based on the located target object data comprises:
removing the target version number spliced in the target object data from the searched target object data to obtain object data with the version number removed;
and utilizing the object data with the version number removed to perform request response aiming at the data query request.
5. An apparatus for responding to a data query request, the apparatus being applied to a cache middleware, wherein object data stored in a cache has a version number, the apparatus comprising:
the request acquisition module is used for acquiring a data query request sent by a data request terminal, wherein the data query request carries a target key value and a target version number;
the object searching module is used for searching unexpired target object data with the target version number and key values as the target key values in a cache;
a request response module, configured to perform a request response for the data query request based on the searched target object data when the target object data is found by the object search module;
the object obtaining module is used for obtaining first object data with a key value as the target key value from a database corresponding to the cache when the target object data is not found by the object searching module;
and the splicing updating module is used for carrying out request response aiming at the data query request based on the acquired first object data, splicing the first object data and the target version number according to a preset splicing mode to obtain spliced second object data, and storing the second object data into the cache.
6. The apparatus according to claim 5, wherein the splicing update module is specifically configured to perform serialization processing on the first object data and the target version number respectively;
and splicing the first object data after the serialization processing and the target version number to obtain spliced second object data.
7. The apparatus of claim 6, wherein the splicing update module is specifically configured to splice the serialized target version number to a tail of the serialized first object data to obtain spliced second object data.
8. The apparatus according to claim 5, wherein the request response module is specifically configured to remove the target version number spliced in the target object data from the searched target object data, so as to obtain object data with the version number removed;
and utilizing the object data with the version number removed to perform request response aiming at the data query request.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 4.
CN202010717256.XA 2020-07-23 2020-07-23 Method, device, electronic equipment and storage medium for responding to data query request Pending CN111831915A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010717256.XA CN111831915A (en) 2020-07-23 2020-07-23 Method, device, electronic equipment and storage medium for responding to data query request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010717256.XA CN111831915A (en) 2020-07-23 2020-07-23 Method, device, electronic equipment and storage medium for responding to data query request

Publications (1)

Publication Number Publication Date
CN111831915A true CN111831915A (en) 2020-10-27

Family

ID=72925099

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010717256.XA Pending CN111831915A (en) 2020-07-23 2020-07-23 Method, device, electronic equipment and storage medium for responding to data query request

Country Status (1)

Country Link
CN (1) CN111831915A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113010535A (en) * 2021-03-12 2021-06-22 北京百度网讯科技有限公司 Cache data updating method, device, equipment and storage medium
CN113127452A (en) * 2021-05-18 2021-07-16 京东科技控股股份有限公司 Data query method, device, equipment, storage medium and program product
CN113282630A (en) * 2021-06-22 2021-08-20 中国平安财产保险股份有限公司 Data query method and device based on interface switching

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107346320A (en) * 2016-05-06 2017-11-14 北京神州泰岳软件股份有限公司 A kind of data calling method and device
CN108959341A (en) * 2018-04-04 2018-12-07 阿里巴巴集团控股有限公司 A kind of method, device and equipment that data are synchronous
CN109558421A (en) * 2018-10-29 2019-04-02 中国建设银行股份有限公司 Data processing method, system, device and storage medium based on caching
CN110134705A (en) * 2018-02-09 2019-08-16 中国移动通信集团有限公司 A kind of data query method, cache server and terminal
CN111125156A (en) * 2019-12-17 2020-05-08 网银在线(北京)科技有限公司 Data query method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107346320A (en) * 2016-05-06 2017-11-14 北京神州泰岳软件股份有限公司 A kind of data calling method and device
CN110134705A (en) * 2018-02-09 2019-08-16 中国移动通信集团有限公司 A kind of data query method, cache server and terminal
CN108959341A (en) * 2018-04-04 2018-12-07 阿里巴巴集团控股有限公司 A kind of method, device and equipment that data are synchronous
CN109558421A (en) * 2018-10-29 2019-04-02 中国建设银行股份有限公司 Data processing method, system, device and storage medium based on caching
CN111125156A (en) * 2019-12-17 2020-05-08 网银在线(北京)科技有限公司 Data query method and device and electronic equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113010535A (en) * 2021-03-12 2021-06-22 北京百度网讯科技有限公司 Cache data updating method, device, equipment and storage medium
CN113010535B (en) * 2021-03-12 2024-03-08 北京百度网讯科技有限公司 Cache data updating method, device, equipment and storage medium
CN113127452A (en) * 2021-05-18 2021-07-16 京东科技控股股份有限公司 Data query method, device, equipment, storage medium and program product
CN113282630A (en) * 2021-06-22 2021-08-20 中国平安财产保险股份有限公司 Data query method and device based on interface switching
CN113282630B (en) * 2021-06-22 2023-09-26 中国平安财产保险股份有限公司 Data query method and device based on interface switching

Similar Documents

Publication Publication Date Title
JP4578160B2 (en) Create and retrieve database table change information that can be used to invalidate cache entries
CN111831915A (en) Method, device, electronic equipment and storage medium for responding to data query request
US8868595B2 (en) Enhanced control to users to populate a cache in a database system
US7313572B2 (en) Attribute partitioning for user extensibility
CN109450969B (en) Method and device for acquiring data from third-party data source server and server
WO2020024903A1 (en) Method and device for searching for blockchain data, and computer readable storage medium
CN108536617B (en) Cache management method, medium, system and electronic device
CN111475519B (en) Data caching method and device
CN109815240B (en) Method, apparatus, device and storage medium for managing index
US20170329708A1 (en) Performing efficient cache invalidation
CN104423982A (en) Request processing method and device
CN112580315A (en) Webpage table display method and device, terminal equipment and medium
CN107577775B (en) Data reading method and device, electronic equipment and readable storage medium
CN110321367B (en) Data storage method, data query method, related device and electronic equipment
CN114691611A (en) Directory refreshing processing method and device, electronic equipment and storage medium
CN111382206A (en) Data storage method and device
CN114416798A (en) Cache management method and device based on data dependency relationship and consistency guarantee
JP5083408B2 (en) Configuration management apparatus, configuration management program, and configuration management method
US9317432B2 (en) Methods and systems for consistently replicating data
CN110427538B (en) Data query method, data storage method, data query device, data storage device and electronic equipment
CN113626483B (en) Front-end caching method, system, equipment and storage medium for filling forms
CN106612336A (en) Picture preloading method and picture preloading device
CN110083509B (en) Method and device for arranging log data
US20050278359A1 (en) Providing mappings between logical time values and real time values in a multinode system
CN111209304B (en) Data processing method, device and system

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