CN106682197B - Search cache updating method and device - Google Patents

Search cache updating method and device Download PDF

Info

Publication number
CN106682197B
CN106682197B CN201611249997.XA CN201611249997A CN106682197B CN 106682197 B CN106682197 B CN 106682197B CN 201611249997 A CN201611249997 A CN 201611249997A CN 106682197 B CN106682197 B CN 106682197B
Authority
CN
China
Prior art keywords
search
cache
result
search request
database
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
CN201611249997.XA
Other languages
Chinese (zh)
Other versions
CN106682197A (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.)
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 CN201611249997.XA priority Critical patent/CN106682197B/en
Publication of CN106682197A publication Critical patent/CN106682197A/en
Application granted granted Critical
Publication of CN106682197B publication Critical patent/CN106682197B/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/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • 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/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (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 updating a search cache, which are applied to the technical field of multimedia, wherein the method comprises the following steps: when a search request is received, inquiring a pre-established first database according to the search request to obtain a cache of a first search result; when the cache of the first search result is judged to be effective, extracting each code corresponding to each information according to each information in the cache of the first search result, and inquiring a pre-established second database according to each code to obtain first coded data; judging whether the first coded data are effective or not, if so, acquiring a first search request result from a first database according to each code; if not, acquiring a second search request result from the third database according to each code, and updating the second search request result to the first database. Compared with the existing search cache updating method, the embodiment of the invention can greatly improve the updating speed of the hot content.

Description

Search cache updating method and device
Technical Field
The present invention relates to the field of multimedia technologies, and in particular, to a method and an apparatus for updating a search cache.
Background
With the continuous development of search, the hot events are continuously upgraded and updated, and the search volume is continuously increased, so that the search cache is an essential important factor for improving the performance and stability of search service. The cache is a temporary file exchange area, is a storage capable of exchanging high-speed data, and exchanges data with the CPU before the memory, so that the speed is extremely high, and the cache is almost a standard configuration of a search engine in order to accelerate the response speed of user inquiry. The search engine puts the search results of the keywords frequently searched by some users into a cache, and when the keywords are searched again, the search results can be directly called from the memory without re-retrieval and ranking from the index database. The introduction of the cache mechanism not only accelerates the reaction speed of the search engine to the user search, but also reduces the repeated calculation of the search engine to the data.
However, when there is a hot content update, the latest relevant information cannot be displayed in the search result page in time during the validity period of the cache.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for updating a search cache, so as to improve the updating speed of hot content. The specific technical scheme is as follows:
the embodiment of the invention discloses a method for updating a search cache, which comprises the following steps:
when a search request is received, inquiring a pre-established first database according to the search request to obtain a cache of a first search result; wherein the first database stores cached results, the cached results comprising: caching search results and caching information;
when the cache of the first search result is judged to be effective, extracting each code corresponding to each information according to each information in the cache of the first search result, and inquiring a pre-established second database according to each code to obtain first coded data, wherein the second database stores the codes;
judging whether the first coded data are valid, if so, acquiring a first search request result from the first database according to each code; and if not, acquiring a second search request result from a third database according to each code, and updating the second search request result to the first database, wherein the third database stores the latest information.
Optionally, before querying a pre-established first database according to the search request to obtain a cache of the first search result, the search cache updating method further includes:
receiving a message queue of the hot content, updating second coded data in the message queue to the second database, and updating information corresponding to the second coded data to the first database.
Optionally, after the querying a pre-established first database according to the search request to obtain a cache of the first search result, the search cache updating method further includes:
and when the cache of the first search result is judged to be invalid, forwarding the search request to a search engine, and updating a third search request result fed back by the search engine and a timestamp of the third search request result fed back by the search engine to the first database.
Optionally, the method for updating a search cache according to the embodiment of the present invention further includes:
when the hot content is updated, extracting third coded data corresponding to the information of the hot content, updating the third coded data to a second database, and updating the information of the hot content to a first database.
Optionally, after the obtaining the first search request result from the first database according to each code, the search cache updating method further includes:
returning the first search request result to a search request client; or the like, or, alternatively,
after obtaining the second search request result from the third database according to each code, the method for updating the search cache further includes:
returning the second search request result to a search request client; or the like, or, alternatively,
after the updating the third search request result fed back by the search engine and the timestamp of the third search request result fed back by the search engine to the first database, the search cache updating method further includes:
and returning the third search request result to the search request client.
Optionally, the step of determining that the cache of the first search result is valid includes:
determining a first difference value between a cached timestamp of a first search result and a cached write timestamp of the first search result;
when the first difference is smaller than a first preset validity period, judging that the cache of the first search result is valid;
the step of determining whether the first encoded data is valid includes:
determining to obtain a second difference value between the time stamp of the first coded data and the writing time stamp of the first coded data;
and judging whether the first coded data is valid according to whether the second difference value is smaller than a second preset validity period.
Optionally, the step of determining that the cache of the first search result is invalid includes:
determining a first difference value between a cached timestamp of a first search result and a cached write timestamp of the first search result;
and when the first difference is larger than or equal to a first preset validity period, judging that the cache of the first search result is invalid.
Optionally, the step of querying a pre-established first database according to the search request includes:
and retrieving the first database according to the request parameters of the search request.
The embodiment of the invention also discloses a device for updating the search cache, which comprises:
the cache acquisition module is used for inquiring a pre-established first database according to a search request to obtain a cache of a first search result when the search request is received; wherein the first database stores cached results, the cached results comprising: caching search results and caching information;
the coded data acquisition module is used for extracting each code corresponding to each piece of information according to each piece of information in the cache of the first search result when the cache of the first search result is judged to be effective, and inquiring a pre-established second database according to each code to obtain first coded data, wherein the second database stores the codes;
the coded data judging module is used for judging whether the first coded data is valid or not;
the first search request result acquisition module is used for acquiring a first search request result from the first database according to each code when the judgment result of the code data judgment module is yes;
and the second search request result acquisition module is used for acquiring a second search request result from a third database according to each code and updating the second search request result to the first database when the judgment result of the code data judgment module is negative, wherein the third database stores the latest information.
Optionally, the search cache updating apparatus according to the embodiment of the present invention further includes:
and the database establishing module is used for receiving a message queue of the hot content, updating the second coded data in the message queue to the second database, and updating the information corresponding to the second coded data to the first database.
Optionally, the search cache updating apparatus according to the embodiment of the present invention further includes:
and the third search request result acquisition module is used for forwarding the search request to a search engine when the cache of the first search result is judged to be invalid, and updating a third search request result fed back by the search engine and a timestamp of the third search request result fed back by the search engine to the first database.
Optionally, the search cache updating apparatus according to the embodiment of the present invention further includes:
and the database updating module is used for extracting third coded data corresponding to the information of the hot content when the hot content is updated, updating the third coded data to a second database, and updating the information of the hot content to the first database.
Optionally, the search cache updating apparatus according to the embodiment of the present invention further includes:
the first search request result returning module is used for returning the first search request result to the search request client; or the like, or, alternatively,
the second search request result returning module is used for returning the second search request result to the search request client; or the like, or, alternatively,
and the third search request result returning module is used for returning the third search request result to the search request client.
Optionally, the encoded data acquiring module includes:
the first difference determining submodule is used for determining a first difference between a timestamp of the cache of the first search result and a writing timestamp of the cache of the first search result;
the cache judgment validity submodule is used for judging that the cache of the first search result is valid when the first difference value is smaller than a first preset validity period;
the coded data judging module comprises:
a second difference determination submodule, configured to determine a second difference between the timestamp of the first encoded data and the write timestamp of the first encoded data;
and the first coded data judging submodule is used for judging whether the first coded data is valid according to whether the second difference value is smaller than a second preset validity period.
Optionally, the third search request result obtaining module includes:
the first difference determining submodule is used for determining a first difference between a timestamp of the cache of the first search result and a writing timestamp of the cache of the first search result;
and the cache judgment invalidation submodule is used for judging that the cache of the first search result is invalid when the first difference is greater than or equal to a first preset validity period.
Optionally, the cache obtaining module is specifically configured to retrieve the first database according to the request parameter of the search request.
According to the method and the device for updating the search cache, when a search request is received and the cache of the first search result acquired from the first database is judged to be effective, each code corresponding to each information is extracted according to each information in the cache of the first search result, and the first coded data is obtained by inquiring from the second database according to each code. Judging whether the first coded data are effective or not, if so, acquiring a first search request result from a first database according to each code; if not, acquiring a second search request result from the third database according to each code, and updating the second search request result to the first database. Therefore, the method and the device for updating the search cache provided by the embodiment of the invention can quickly obtain and return the search request result of the updated hot content when the search request is received, thereby improving the updating speed of the hot content. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
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, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a search cache updating method according to an embodiment of the present invention;
FIG. 2 is another flowchart of a search cache updating method according to an embodiment of the present invention;
FIG. 3 is a block diagram of a search cache update apparatus according to an embodiment of the present invention;
fig. 4 is another structural diagram of the search cache updating apparatus according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
With the development of internet technology, search technology is receiving more and more attention. In the search request of the user, a small number of search terms account for a considerable proportion of the search request, and the number of times of single occurrence of most of the search terms is very small, so that the search engine can deal with the search request of most of the users by storing the search results of the small number of search terms frequently queried by the users in the cache. Each cache has a validity period, and the latest relevant information cannot be displayed in the search result page in time in the validity period of the cache. Wherein, the longer the validity period of the cache is, the higher the hit rate of the cache is. If the validity period of the cache is reduced, although the cache hit rate can be reduced and the update speed can be increased, the update speed is not too strong for some non-hot content. Therefore, the updating speed of the hot content in the prior art is slow under the condition of not reducing the search caching period.
The embodiment of the invention discloses a search cache updating method which can improve the updating speed of hot content. Referring to fig. 1, fig. 1 is a flowchart of a search cache updating method according to an embodiment of the present invention, including the following steps:
s101, when a search request is received, inquiring a pre-established first database according to the search request to obtain a cache of a first search result; wherein, the first database stores cache results, and the cache results include: caching of search results and caching of information.
It is understood that the search request of the user is processed by the corresponding server and the search request result is returned to the user. In the embodiment of the invention, two databases, namely a first database and a second database, are firstly established on a server for processing a search request, wherein the first database stores the cache of search results and the cache of information. And inquiring the first database according to the current search request to obtain the cache of the first search result. Where the search request may be a search term, a search site, and so forth.
For example, when the received search request is a search request for video information, the first database stores a cache of video search results and a cache of video information. If the current search request is a search term, the search term is a certain hot-broadcast series, then the first database is queried according to the hot-broadcast series to obtain a cache of search results for the hot-broadcast series.
S102, judging whether the cache of the first search result is effective.
When the cache of the first search result is judged to be valid, S103 is executed, each code corresponding to each information is extracted according to each information in the cache of the first search result, and a pre-established second database is inquired according to each code to obtain first coded data, wherein the second database stores the codes.
It should be noted that both the caching and the encoding of the search results have a certain validity period, which may be several minutes or several tens of minutes, and are set according to specific contents. Generally, for hot content, the validity period of the cache is short, and the update speed of the hot content is fast, while for non-hot content, the validity period of the cache is long, and the update speed of the non-hot content is slow. For the two databases established in S101, the first database stores the cache of the search result and the cache of the information, and the database includes the cache of the search result of the hot content and the cache of the information corresponding to the hot content, and certainly also includes the cache of the search result of the non-hot content and the cache of the information corresponding to the non-hot content. And the encoded data stored in the second database is encoded data corresponding to the information of the hot content, where the encoding corresponds to the specific information content, and the format of the encoding may be an encoding format in the prior art, for example, if the information of the hot content is picture information, the encoded data is picture encoding, and correspondingly, the encoded data may be base64 encoding.
And when the cache of the first search result is judged to be in the validity period, extracting each code corresponding to each information according to each information in the cache of the first search result, and inquiring a pre-established second database according to each code to obtain the first coded data. It can be understood that the second database stores the code corresponding to the information of the hot content, and if the first coded data is acquired from the second database, it indicates that the information corresponding to the first coded data is the information of the hot content.
In the embodiment of the present invention, a cache of a search result of a certain hot-cast drama is taken as an example for explanation, and if the cache of the first search result is the cache of the search result of the hot-cast drama, the cache of the search result of the hot-cast drama includes a plurality of pieces of video information of the hot-cast drama, and each piece of video information corresponds to one code. And querying a second database according to each code to obtain first coded data, wherein the first coded data is a code corresponding to the video information of the hot broadcast television series. If the first coded data is not obtained, the video information of the hot television play is not the information of the hot content.
S104, judging whether the first coded data is valid. If yes, S105 is executed, and a first search request result is obtained from the first database according to each code; if not, S106 is executed, a second search request result is obtained from a third database according to each code, and the second search request result is updated to the first database, wherein the third database stores the latest information.
Obviously, the first encoded data is also valid, and generally, the valid period of the encoding is shorter than the valid period of the cache, that is, in the case of the expired encoding, the cache of the information corresponding to the encoding may be still valid, and if the encoding is still valid, the cache of the information corresponding to the encoding may not have passed the valid period. In the embodiment of the present invention, first, the first encoded data is extracted according to the cache of the search result, and then, when the first encoded data is valid, specific information is obtained from the cache of the information according to the first encoded data, and the specific information is used as the first search request result. Or when the first coded data is invalid, acquiring a second search request result from a third database.
For example, the first encoded data obtained in S103 is a code corresponding to video information of a certain hot-play television play, and if the first encoded data is valid, the video information of the hot-play television play is obtained from the first database according to the first encoded data, and the obtained video information is the first search request result. And if the first coded data are invalid, directly acquiring the video information of the hot broadcast television series from the third database according to the first coded data, wherein the acquired video information is the second search request result, and updating the second search request result into the first database.
It should be noted that the third database stores the latest information, the latest information is the information closest to the current timestamp, and may be the data within half an hour or within 1 hour from the current timestamp, and the specific time period is not limited here. In addition, updating the second search request result into the first database means that the second search request result replaces specific information in the cache of the search result in the first database, so that the cache of the search result is up-to-date.
It can be seen that, in the method for updating a search cache according to the embodiments of the present invention, when a search request is received, a first database is first queried according to the search request, when a cache of a first search result obtained from the first database is valid, a code is extracted according to information in the cache of the first search result, so as to obtain first coded data, and when the first coded data is valid, a result of the first search request is directly obtained from the first database; and when the first coded data is invalid, acquiring a second search request result from a third database storing latest information according to the first coded data. The embodiment of the invention can quickly obtain and return the search request result of the updated hot content, and improves the updating speed of the hot content.
Referring to fig. 2, fig. 2 is another flowchart of a search cache updating method according to an embodiment of the present invention, and on the basis of the embodiment shown in fig. 1, the search cache updating method according to the embodiment of the present invention further includes:
s201, when the cache of the first search result is judged to be invalid, the search request is forwarded to a search engine, and a third search request result fed back by the search engine and a timestamp of the third search request result fed back by the search engine are updated to the first database.
Specifically, if the cache of the first search result obtained by the search request is invalid, which indicates that the data in the first database has passed the validity period, the search request needs to be forwarded to the search engine, and a third search request result is obtained according to the search engine. The third search request result is similar to the first search request result and the second search request result, and the processing procedure of the search engine belongs to the prior art, and will not be described in detail here.
S202, returning a first search request result to a search request client; or, returning the second search request result to the search request client; or, returning the third search request result to the search request client.
In the embodiment of the invention, after the first search request result is obtained, the server for processing the search request returns the first search request result to the search request client; or after the second search request result is obtained, the server for processing the search request returns the second search request result to the search request client; or after the third request result is obtained, the server for processing the search request returns the third request result to the search request client, so that the user can conveniently view the specific search request result.
Optionally, before querying a pre-established first database according to the search request to obtain a cache of the first search result, the search cache updating method according to the embodiment of the present invention further includes:
and receiving a message queue of the hot content, updating the second coded data in the message queue to a second database, and updating information corresponding to the second coded data to the first database.
In the embodiment of the invention, the first database and the second database are pre-established, the hot content in different periods is different, the server processing the search request receives the message queue of the hot content according to the current hot content, updates the second coded data in the message queue to the second database, and updates the information corresponding to the second coded data to the first database, thereby forming the first database and the second database. If the hot content is a hot picture, the second coded data is picture coded data, and the information corresponding to the second coded data is the hot picture.
Optionally, the method for updating a search cache according to the embodiment of the present invention further includes:
when the hot content is updated, extracting third coded data corresponding to the information of the hot content, updating the third coded data to a second database, and updating the information of the hot content to the first database.
Specifically, after the first database and the second database are established, if the hot content is updated, the update data corresponding to the information and the code needs to be updated to the first database and the second database. If the hot content is the hot picture, the third encoded data is the code of the new hot picture, and the code of the new hot picture needs to be updated to the second database and the new hot picture needs to be updated to the first database.
In an implementation manner of the embodiment of the present invention, the step of determining that the cache of the first search result is valid includes:
first, a first difference between a timestamp of the first search result cache and a write timestamp of the first search result cache is determined.
And then, when the first difference is smaller than the first preset validity period, judging that the cache of the first search result is valid.
Similarly, the cache of the search result has a corresponding write-in time, and the timestamp of the cache of the first search result indicates a current timestamp in the process of processing the search request, and a first difference between the current timestamp and the write-in timestamp of the cache of the first search result, that is, an existence time of the cache of the first search result indicates that the cache of the first search result is still in the validity period, that is, has not expired, if the existence time is less than the first preset validity period. Wherein the first preset validity period may be 10 minutes, 5 minutes, etc.
The step of determining whether the first encoded data is valid includes:
first, a second difference between the time stamp of the first encoded data and the write time stamp of the first encoded data is determined.
And then, judging whether the first coded data is valid according to whether the second difference value is smaller than a second preset validity period.
The timestamp for obtaining the first encoding data is similar to the timestamp for obtaining the cache of the first search result, and both refer to the current timestamp in the process of processing the search request, and of course, the timestamps are different. Similarly, the second difference is similar to the first difference, and refers to the existence time of the first encoded data, and whether the first encoded data is valid is determined according to whether the existence time of the first encoded data is less than a second preset validity period. Wherein the second predetermined expiration date may be 8 minutes, 3 minutes, etc. It is emphasized that the second preset validity period is shorter than the first preset validity period, which has already been described at S103 and will not be described herein.
In an implementation manner of the embodiment of the present invention, the step of determining that the cache of the first search result is invalid includes:
first, a first difference between a timestamp of the first search result cache and a write timestamp of the first search result cache is determined.
Then, when the first difference is larger than or equal to the first preset validity period, the cache of the first search result is judged to be invalid.
The method for determining whether the cache of the first search result is invalid is similar to the above method for determining whether the cache of the first search result is valid, and details are not repeated here.
Optionally, in the method for updating a search cache according to the embodiment of the present invention, the step of querying the pre-established first database according to the search request includes:
the first database is retrieved according to the request parameters of the search request.
In practical applications, the search request of the client includes various ways, for example: search terms, platform types, site restrictions, etc., may be one of the above, or a combination of the above. Specifically, when the search request is a search word, the server processing the search request directly retrieves the first database according to the search word; when the search request is limited by the network station, the server processing the search request carries out retrieval according to the limited network station.
Corresponding to the above method embodiment, the embodiment of the present invention further discloses a search cache updating apparatus, referring to fig. 3, where fig. 3 is a structural diagram of the search cache updating apparatus of the embodiment of the present invention, including:
the cache obtaining module 301 is configured to, when a search request is received, query a pre-established first database according to the search request to obtain a cache of a first search result; wherein, the first database stores cache results, and the cache results include: caching of search results and caching of information.
The encoded data obtaining module 302 is configured to, when it is determined that the cache of the first search result is valid, extract each code corresponding to each piece of information according to each piece of information in the cache of the first search result, and query a second database established in advance according to each code to obtain the first encoded data, where the second database stores the codes.
And the encoded data judging module 303 is configured to judge whether the first encoded data is valid.
A first search request result obtaining module 304, configured to, when the determination result of the encoded data determining module is yes, obtain a first search request result from the first database according to each of the codes.
A second search request result obtaining module 305, configured to, if the determination result of the code data determining module is negative, obtain a second search request result from a third database according to each code, and update the second search request result to the first database, where the third database stores the latest information.
It can be seen that, in the search cache updating apparatus provided in the embodiment of the present invention, when a search request is received, first, a first database is queried according to the search request, when a cache of a first search result obtained from the first database is valid, a code is extracted according to information in the cache of the first search result, so as to obtain first coded data, and when the first coded data is valid, a result of the first search request is directly obtained from the first database; and when the first coded data is invalid, acquiring a second search request result from a third database storing latest information according to the first coded data. The embodiment of the invention can quickly obtain and return the search request result of the updated hot content, and improves the updating speed of the hot content.
Referring to fig. 4, fig. 4 is another structural diagram of a search cache updating apparatus according to an embodiment of the present invention, and on the basis of the embodiment shown in fig. 3, the search cache updating apparatus according to the embodiment of the present invention further includes:
the database establishing module 401 is configured to receive a message queue of the hot content, update the second encoded data in the message queue to the second database, and update information corresponding to the second encoded data to the first database.
The database updating module 402 is configured to, when the hot content is updated, extract third encoded data corresponding to the information of the hot content, update the third encoded data to the second database, and update the information of the hot content to the first database.
The third search request result obtaining module 403 is configured to, when it is determined that the cache of the first search result is invalid, forward the search request to the search engine, and update the third search request result fed back by the search engine and the timestamp of the third search request result fed back by the search engine to the first database.
Optionally, the search cache updating apparatus according to the embodiment of the present invention further includes:
the first search request result returning module is used for returning the first search request result to the search request client; or the like, or, alternatively,
the second search request result returning module is used for returning the second search request result to the search request client; or the like, or, alternatively,
and the third search request result returning module is used for returning the third search request result to the search request client.
Optionally, in the apparatus for updating search cache according to the embodiment of the present invention, the encoded data obtaining module includes:
and the first difference determining submodule is used for determining a first difference between the timestamp of the cache of the first search result and the write timestamp of the cache of the first search result.
And the cache judgment validity submodule is used for judging that the cache of the first search result is valid when the first difference value is smaller than the first preset validity period.
The coded data judging module comprises:
and the second difference determining submodule is used for determining a second difference between the time stamp of the first coded data and the writing time stamp of the first coded data.
And the first coded data judging submodule is used for judging whether the first coded data is valid according to whether the second difference value is smaller than a second preset validity period.
Optionally, in the search cache updating apparatus according to the embodiment of the present invention, the third search request result obtaining module includes:
and the first difference determining submodule is used for determining a first difference between the timestamp of the cache of the first search result and the write timestamp of the cache of the first search result.
And the cache judgment invalidation submodule is used for judging that the cache of the first search result is invalid when the first difference is greater than or equal to the first preset validity period.
Optionally, in the search cache updating apparatus according to the embodiment of the present invention, the cache obtaining module is specifically configured to retrieve the first database according to a request parameter of the search request.
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, for the system embodiment, since it is substantially similar to the method embodiment, the description is 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 (16)

1. A method for updating a search cache, comprising:
when a search request is received, inquiring a pre-established first database according to the search request to obtain a cache of a first search result; wherein the first database stores cached results, the cached results comprising: caching search results and caching information;
when the cache of the first search result is judged to be effective, extracting each code corresponding to each information according to each information in the cache of the first search result, and inquiring a pre-established second database according to each code to obtain first coded data, wherein the second database stores the coded data;
judging whether the first coded data are valid, if so, acquiring a first search request result from the first database according to each code; and if not, acquiring a second search request result from a third database according to each code, and updating the second search request result to the first database, wherein the third database stores the latest information.
2. The method according to claim 1, wherein the first database pre-established according to the search request is queried to obtain a cache of first search results, and before the method further comprises:
receiving a message queue of the hot content, updating second coded data in the message queue to the second database, and updating information corresponding to the second coded data to the first database.
3. The method according to claim 1, wherein the first database pre-established according to the search request is queried to obtain a cache of first search results, and thereafter, the method further comprises:
and when the cache of the first search result is judged to be invalid, forwarding the search request to a search engine, and updating a third search request result fed back by the search engine and a timestamp of the third search request result fed back by the search engine to the first database.
4. The search cache updating method according to claim 2, further comprising:
when the hot content is updated, extracting third coded data corresponding to the information of the hot content, updating the third coded data to a second database, and updating the information of the hot content to a first database.
5. The method of claim 3, wherein after said retrieving the first search request result from the first database according to said each code, the method further comprises:
returning the first search request result to a search request client; or the like, or, alternatively,
after obtaining the second search request result from the third database according to each code, the method further includes:
returning the second search request result to a search request client; or the like, or, alternatively,
after the updating the third search request result fed back by the search engine and the timestamp of the third search request result fed back by the search engine to the first database, the method further comprises:
and returning the third search request result to the search request client.
6. The method according to claim 1, wherein the step of determining that the first search result cache is valid comprises:
determining a first difference value between a cached timestamp of a first search result and a cached write timestamp of the first search result;
when the first difference is smaller than a first preset validity period, judging that the cache of the first search result is valid;
the step of determining whether the first encoded data is valid includes:
determining to obtain a second difference value between the time stamp of the first coded data and the writing time stamp of the first coded data;
and judging whether the first coded data is valid according to whether the second difference value is smaller than a second preset validity period.
7. The method according to claim 3, wherein the step of determining that the cache of the first search result is invalid comprises:
determining a first difference value between a cached timestamp of a first search result and a cached write timestamp of the first search result;
and when the first difference is larger than or equal to a first preset validity period, judging that the cache of the first search result is invalid.
8. The method according to claim 1, wherein the step of querying the pre-established first database according to the search request comprises:
and retrieving the first database according to the request parameters of the search request.
9. A search cache updating apparatus, comprising:
the cache acquisition module is used for inquiring a pre-established first database according to a search request to obtain a cache of a first search result when the search request is received; wherein the first database stores cached results, the cached results comprising: caching search results and caching information;
the coded data acquisition module is used for extracting each code corresponding to each piece of information according to each piece of information in the cache of the first search result when the cache of the first search result is judged to be effective, and inquiring a pre-established second database according to each code to obtain first coded data, wherein the second database stores the coded data;
the coded data judging module is used for judging whether the first coded data is valid or not;
the first search request result acquisition module is used for acquiring a first search request result from the first database according to each code when the judgment result of the code data judgment module is yes;
and the second search request result acquisition module is used for acquiring a second search request result from a third database according to each code and updating the second search request result to the first database when the judgment result of the code data judgment module is negative, wherein the third database stores the latest information.
10. The search cache updating apparatus according to claim 9, further comprising:
and the database establishing module is used for receiving a message queue of the hot content, updating the second coded data in the message queue to the second database, and updating the information corresponding to the second coded data to the first database.
11. The search cache updating apparatus according to claim 9, further comprising:
and the third search request result acquisition module is used for forwarding the search request to a search engine when the cache of the first search result is judged to be invalid, and updating a third search request result fed back by the search engine and a timestamp of the third search request result fed back by the search engine to the first database.
12. The search cache updating apparatus according to claim 10, further comprising:
and the database updating module is used for extracting third coded data corresponding to the information of the hot content when the hot content is updated, updating the third coded data to a second database, and updating the information of the hot content to the first database.
13. The search cache updating apparatus according to claim 11, further comprising:
the first search request result returning module is used for returning the first search request result to the search request client; or the like, or, alternatively,
the second search request result returning module is used for returning the second search request result to the search request client; or the like, or, alternatively,
and the third search request result returning module is used for returning the third search request result to the search request client.
14. The apparatus according to claim 9, wherein the encoded data obtaining module comprises:
the first difference determining submodule is used for determining a first difference between a timestamp of the cache of the first search result and a writing timestamp of the cache of the first search result;
the cache judgment validity submodule is used for judging that the cache of the first search result is valid when the first difference value is smaller than a first preset validity period;
the coded data judging module comprises:
a second difference determination submodule, configured to determine a second difference between the timestamp of the first encoded data and the write timestamp of the first encoded data;
and the first coded data judging submodule is used for judging whether the first coded data is valid according to whether the second difference value is smaller than a second preset validity period.
15. The apparatus according to claim 11, wherein the third search request result obtaining module comprises:
the first difference determining submodule is used for determining a first difference between a timestamp of the cache of the first search result and a writing timestamp of the cache of the first search result;
and the cache judgment invalidation submodule is used for judging that the cache of the first search result is invalid when the first difference is greater than or equal to a first preset validity period.
16. The search cache updating apparatus according to claim 9, wherein the cache obtaining module is specifically configured to retrieve the first database according to a request parameter of the search request.
CN201611249997.XA 2016-12-29 2016-12-29 Search cache updating method and device Active CN106682197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611249997.XA CN106682197B (en) 2016-12-29 2016-12-29 Search cache updating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611249997.XA CN106682197B (en) 2016-12-29 2016-12-29 Search cache updating method and device

Publications (2)

Publication Number Publication Date
CN106682197A CN106682197A (en) 2017-05-17
CN106682197B true CN106682197B (en) 2020-02-11

Family

ID=58872223

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611249997.XA Active CN106682197B (en) 2016-12-29 2016-12-29 Search cache updating method and device

Country Status (1)

Country Link
CN (1) CN106682197B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301215B (en) * 2017-06-09 2020-12-18 北京奇艺世纪科技有限公司 Search result caching method and device and search method and device
CN110413679B (en) * 2019-07-31 2023-01-24 深圳前海微众银行股份有限公司 Database information processing method, device, equipment and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101206665A (en) * 2007-12-12 2008-06-25 宁波新然电子信息科技发展有限公司 Multilingual words information searching method
CN102915380A (en) * 2012-11-19 2013-02-06 北京奇虎科技有限公司 Method and system for carrying out searching on data
CN102982023A (en) * 2011-09-02 2013-03-20 北京百度网讯科技有限公司 Method and device for providing search suggestion
CN104021193A (en) * 2014-06-13 2014-09-03 北京奇虎科技有限公司 Search switching method and search switching device
CN104123356A (en) * 2014-07-17 2014-10-29 成都康赛信息技术有限公司 Method for increasing webpage response speed under large data volume condition
CN104794228A (en) * 2015-04-30 2015-07-22 北京奇艺世纪科技有限公司 Search result providing method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9037597B2 (en) * 2011-01-10 2015-05-19 International Business Machines Corporation Verifying file versions in a networked computing environment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101206665A (en) * 2007-12-12 2008-06-25 宁波新然电子信息科技发展有限公司 Multilingual words information searching method
CN102982023A (en) * 2011-09-02 2013-03-20 北京百度网讯科技有限公司 Method and device for providing search suggestion
CN102915380A (en) * 2012-11-19 2013-02-06 北京奇虎科技有限公司 Method and system for carrying out searching on data
CN104021193A (en) * 2014-06-13 2014-09-03 北京奇虎科技有限公司 Search switching method and search switching device
CN104123356A (en) * 2014-07-17 2014-10-29 成都康赛信息技术有限公司 Method for increasing webpage response speed under large data volume condition
CN104794228A (en) * 2015-04-30 2015-07-22 北京奇艺世纪科技有限公司 Search result providing method and device

Also Published As

Publication number Publication date
CN106682197A (en) 2017-05-17

Similar Documents

Publication Publication Date Title
CN106682202B (en) Search cache updating method and device
AU2016382908B2 (en) Short link processing method, device and server
US8140495B2 (en) Asynchronous database index maintenance
JP5613951B2 (en) Method for aggressive information push notification and server therefor
CN102737133B (en) A kind of method of real-time search
WO2015096609A1 (en) Method and system for creating inverted index file of video resource
US20190213275A1 (en) Scalable synchronization with cache and index management
CN101311934A (en) Medium player based key words content issue method and system
CN106682197B (en) Search cache updating method and device
CN102654879B (en) Search method and device
US7970760B2 (en) System and method for automatic detection of needy queries
JP5374444B2 (en) SEARCH DEVICE, SEARCH METHOD, AND SEARCH PROGRAM
KR102415155B1 (en) Apparatus and method for retrieving data
KR20150008635A (en) Device for selecting core kyword, method for selecting core kyword, and method for providing search service using the same
JP2010198258A (en) Cache maintenance device, method and program thereof
CN111581238B (en) Information query method and device, electronic equipment and computer readable storage medium
US20040230744A1 (en) Cache content protocol for a content data delivery system
CN107229699B (en) System and method for improving search experience of mobile terminal user
CN101165687A (en) Search engine result information automatic emerging method
CN116561469A (en) Content pushing method and device and electronic equipment
KR100449124B1 (en) The method of massive real-time location information process using main memory dbms and spatial index
CN118069639A (en) Commodity data management method, device, equipment and medium
CN114238732A (en) Data duplication eliminating method and terminal in process of crawling posted text
CN114443653A (en) Database data field enumeration-based unified access method, system, terminal 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