Search cache processing method and device, electronic equipment and storage medium

By receiving search requests in electronic devices and searching for local cached data, determining the changes in the status of resource index database and processing cached data, the problem of high cost and high latency of Q&A system is solved, and the effect of efficiently cache search results and reducing call frequency is achieved.

CN120216733APending Publication Date: 2025-06-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510295613.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-12
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

When searching in electronic devices in prior art, the Q&A system has a high operating cost, high usage cost and high feedback delay, making it difficult to effectively cache search results and reduce the frequency of calling the Q&A system.

Method used

By receiving the current search request, multiple cached data are searched for local cached based on the search request, including search data cache and resource index database status cache. If a matching target cache data is found, the change in the resource index database status of its resource index database is determined, and the target cache data is processed based on this change.

Benefits of technology

Effectively cache search results, reduce the frequency of calling the Q&A system, reduce the cost of use, and effectively reduce search delay and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120216733A_ABST
    Figure CN120216733A_ABST
Patent Text Reader

Abstract

The invention discloses a processing method and device for a search cache, electronic equipment and a storage medium. Multiple pieces of cache data cached locally are searched on the basis of a received current search request, the cache data comprise a search data cache and a resource index database state cache, and the search data cache comprises a search request, search resources and a resource index database state cache item identifier; and if target cache data of which the search request is matched with the current search request is searched from the multiple pieces of cache data, determining a change condition of a target resource index database state corresponding to a target search resource included in the target cache data, and processing the target cache data based on the change condition. The cache data can be processed according to the state change of the resource index database, so that the search result is effectively cached, the calling frequency of a search question-answering system is reduced, the use cost is reduced, meanwhile, the search delay can be effectively reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of data search, and more specifically, to a method, apparatus, electronic device, and storage medium for processing search caches. Background Art

[0002] With the development of science and technology, electronic devices are used more and more widely and have more and more functions, and have become one of the necessities in people's daily lives. At present, users can search for desired resources through electronic devices. Correspondingly, the electronic devices search through the question-and-answer system and feedback the search results. However, the operating cost and usage cost of the question-and-answer system are relatively high, and the question-and-answer system requires network transmission and reasoning, and its feedback delay is also relatively high.

[0003] Object of the invention

[0004] In view of the above problems, this application proposes a method, apparatus, electronic device, and storage medium for processing search caches to solve the above problems.

[0005] In a first aspect, an embodiment of this application provides a method for processing a search cache. The method includes: receiving a current search request; searching for a plurality of cached data in a local cache based on the current search request, where the cached data includes a search data cache and a resource index database status cache, the search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache entry identifier corresponding to the search resource, and the resource index database status cache is a snapshot of the resource index database status corresponding to the search resource; if target cached data including a search request matching the current search request is found from the plurality of cached data, determining a change situation of a target resource index database status corresponding to a target search resource included in the target cached data; and processing the target cached data based on the change situation.

[0006] Second aspect, an embodiment of the present application provides a processing device for search cache. The device includes: a search request receiving module, configured to receive a current search request; a cache data searching module, configured to search multiple cached data locally cached based on the current search request, where the cached data includes search data cache and resource index database status cache, the search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache entry identifier corresponding to the search resource, and the resource index database status cache is a snapshot of the resource index database status corresponding to the search resource; a change situation determining module, configured to, if a target cached data including a search request matching the current search request is found from the multiple cached data, determine a change situation of the target resource index database status corresponding to the target search resource included in the target cached data; and a cached data processing module, configured to process the target cached data based on the change situation.

[0007] Third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, the memory is coupled to the processor, and the memory stores instructions, when the instructions are executed by the processor, the processor executes the above method.

[0008] Fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which program code is stored, and the program code can be called by a processor to execute the above method.

[0009] The search cache processing method, device, electronic device, and storage medium provided by the embodiments of the present application first search multiple cached data locally cached based on the current search request when receiving the current search request. Among them, the cached data includes search data cache and resource index database status cache. The search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache entry identifier corresponding to the search resource. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resource. Then, if a target cached data including a search request matching the current search request is found from the multiple cached data, determine a change situation of the target resource index database status corresponding to the target search resource included in the target cached data. Finally, process the target cached data based on the change situation, so as to be able to process the cached data according to the status change of the resource index database, and then effectively cache the search results, reduce the call frequency of the question answering system, reduce the usage cost, and at the same time be able to effectively reduce the search latency and improve the user experience. Description of the Drawings

[0010] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0011] Figure 1 It shows a schematic flowchart of a method for processing a search cache provided by an embodiment of the present application;

[0012] Figure 2 It shows a schematic diagram of the communication of the local cache system provided by an embodiment of the present application;

[0013] Figure 3 It shows a schematic flowchart of a method for processing a search cache provided by an embodiment of the present application;

[0014] Figure 4 It shows a schematic flowchart of a method for processing a search cache provided by an embodiment of the present application;

[0015] Figure 5 It shows a schematic flowchart of a method for processing a search cache provided by an embodiment of the present application;

[0016] Figure 6 It shows a schematic flowchart of a method for processing a search cache provided by an embodiment of the present application;

[0017] Figure 7 It shows a schematic flowchart of a method for processing a search cache provided by an embodiment of the present application;

[0018] Figure 8 It shows the complete process of the method for processing a search cache that can be used in the embodiments of the present application;

[0019] Figure 9 It shows a block diagram of a processing device for a search cache provided by an embodiment of the present application;

[0020] Figure 10 It shows a block diagram of an electronic device for executing the method for processing a search cache according to the embodiments of the present application;

[0021] Figure 11 It shows a storage unit for storing or carrying program codes for implementing the method for processing a search cache according to the embodiments of the present application. Detailed implementation manners

[0022] To enable those skilled in the art to better understand the solutions of the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application.

[0023] With the development of software and hardware technologies, the functions of current electronic devices are becoming increasingly rich, and users can obtain rich experiences only through electronic devices. However, from another perspective, the increasing number of applications and functions has also led to the complexity of information in electronic devices. When a user needs a certain function or data, the current method usually requires the user to enter a specific application and find the specific item by searching for accurate keywords. When the user is not clear about the specific application from which it comes or the specific keywords, the accurate target object cannot be found through retrieval.

[0024] In short, the data and functions of current electronic devices are isolated according to applications, and users cannot retrieve any content they want to retrieve in the electronic device through a unified search entry. At the same time, the current local retrieval of electronic devices usually only supports exact search based on keywords, or limited fuzzy search with generalization of near synonyms and synonyms. When the user cannot remember the exact keywords, the accurate content cannot be found.

[0025] The inventors have found through research that cross-application / resource local retrieval can support the joint retrieval of multiple applications and resources from a unified entry, thus breaking down application barriers and achieving exhaustive search of local resources, which can greatly improve the user's local search experience on the client side. At the same time, sending the local search results to a search and question-answering system (such as a large model) for further refined search can achieve more accurate, intelligent, and refined search results.

[0026] Search and question-answering systems are usually limited by operating costs, and their usage costs are relatively high; and due to the need for network transmission and inference, their feedback latency is also relatively high. One solution is to locally cache the results of the question and answer. When encountering the same or similar search requests, the search results can be obtained by querying the cache, thus avoiding the increase in usage costs and search latency caused by repeated calls to the search and question-answering system for inference.

[0027] The current search cache solutions mainly include the following:

[0028] 1) Exact match: Exactly match the search query request (query), and only exactly the same query can hit the same cache. This method is simple to implement, but can only handle exactly the same search requests, and has poor recognition and reuse capabilities for similar queries.

[0029] 2) Semantic matching: Introduce a semantic similarity model to vectorize the query. When caching, both the query text and its corresponding vector are stored. When querying, the query to be searched is vectorized and the similarity is calculated with the vectors in the cache. The query with a similarity higher than the similarity threshold is preferentially selected as the cached item that is hit. This method can improve the cache reuse rate to a certain extent, but the introduction of the semantic model makes the caching process more complex.

[0030] 3) Rule matching: Normalize the query based on rules (such as capitalization, punctuation, word order, etc.), and then perform exact matching. The advantage of this method is that no additional model needs to be introduced, but the disadvantage is that the coverage of the rules is limited, and queries beyond the scope of the rules cannot be normalized.

[0031] Moreover, different from cloud search, local data is relatively limited and the data will constantly change (add, delete, modify, etc.), resulting in a relatively short timeliness of local resources. Therefore, it is also necessary to update and maintain the local cached data synchronously. The current cache update and invalidation schemes mainly include the following:

[0032] 1) Validity judgment based on timestamp: Based on the difference between the timestamp when the cache item is cached and the current access time, judge whether it is greater than the preset threshold; if it is greater, it means the cache item has expired; otherwise, it is valid. This method is simple and easy to implement, but it cannot flexibly handle data changes and may misjudge expired data as valid.

[0033] 2) Validity judgment based on access frequency: Judge whether the access frequency of the cache item within a preset time period is less than the specified threshold; if it is less, it means the cache item has expired; otherwise, it is valid. This method can optimize the cache according to the popularity of the data, but for newly added cache items, their access frequencies are relatively low and are easily cleared by mistake.

[0034] 3) Validity judgment based on cache capacity: If the total number of cache items exceeds the maximum value of the cache capacity, the oldest or least frequently accessed cache item needs to be cleared to expire. This method can effectively control the scale of the cache and prevent the cache from growing infinitely, but it lacks the judgment of the timeliness of the cached data and may clear still valid data.

[0035] 4) Validity judgment based on version: Detect the version of the search question-answering system. If there is a version change, it means that the previous cache results have expired. This method can solve the cache inconsistency problem caused by the iteration of the search question-answering system. However, in practical applications, the update frequency of the search question-answering system is usually slow. If the model version is used as the only criterion for invalidation, it may lead to untimely update of the cached data.

[0036] In summary, although the current search cache and cache invalidation solutions can play a certain role in improving the search experience and saving resource overhead, there are still many deficiencies.

[0037] In view of the above problems, through long-term research, the inventors have found and proposed a method, device, electronic device, and storage medium for processing search caches provided in the embodiments of the present application. The method can process cached data according to the state changes of the resource index database, thereby effectively caching search results, reducing the call frequency of the search question-and-answer system, reducing the usage cost, and at the same time effectively reducing search latency and improving the user experience. Among them, the specific method for processing search caches will be described in detail in the subsequent embodiments.

[0038] Next, the terms that may be involved in the method for processing search caches provided in the embodiments of the present application will be explained.

[0039] QA (Question and Answer): Question and answer.

[0040] LLM (Large Language Model): Large model.

[0041] Search resources: Data sources connected to the index system, such as notes, documents, photo albums, etc.; these search resources are the objects of local search and the carriers of raw data. Different types of search resources contain different data contents, providing diverse information for users.

[0042] Resource index database: The corresponding index database generated when search resources are connected to the index system; this resource index database can store the key features and index information of search resources, such as the keywords and creation time of documents, the shooting location of pictures, etc., for quickly locating and retrieving search resources.

[0043] Resource index database status: The status of the resource index database corresponding to search resources, such as the refresh time, total number of data items, etc.; this resource index database status is used to reflect the situation of the resource index database to judge the validity of cached data.

[0044] Resource index database status cache: A snapshot of the resource index database status, that is, the status information of the resource index database at a certain moment is cached. The resource index database status can be quickly obtained through the resource index database status cache.

[0045] Cache database: The database where cached data is stored.

[0046] Cache entry: A piece of cached data item in the cache database.

[0047] Local Search: Cross-resource / application search on the device side will simultaneously search and aggregate multiple resources, and will send the aggregated search results to the search Q&A system for refined search, so as to obtain more intelligent and accurate search results.

[0048] Please refer to Figure 1 , Figure 1 which shows a schematic flowchart of a method for processing search cache provided by an embodiment of the present application. This method can process cached data according to the state changes of the resource index database, and then effectively cache search results, so as to reduce the call frequency of the Q&A system, reduce the usage cost, and at the same time can effectively reduce search latency and improve the user experience. In a specific embodiment, the method for processing search cache is applied to a search cache processing device 200 as shown in Figure 9 and an electronic device 100 configured with the search cache processing device 200 ( Figure 10 ). Hereinafter, taking the electronic device as an example, the specific process of this embodiment will be described. Of course, it can be understood that the electronic device to which this embodiment is applied may include a smart phone, a tablet computer, a vehicle-mounted device, etc., which are not limited herein. Next, the process shown in Figure 1 will be elaborated in detail. The method for processing search cache may specifically include the following steps:

[0049] Step S110: Receive the current search request.

[0050] In this embodiment, when the user expects to perform a resource search through the electronic device, the search request can be input through the electronic device. Correspondingly, the electronic device can receive the search request as the current search request.

[0051] In some embodiments, the electronic device may provide a unified entry that supports the combined search of multiple applications and resources. When the user inputs a search request through the unified entry, the electronic device can receive the search request as the current search request through the unified entry, and respond to the current search request to perform a combined retrieval of multiple applications and resources. For example, a combined retrieval of resources such as notes, documents, and photo albums is performed.

[0052] Step S120: Search multiple cached data cached locally based on the current search request, where the cached data includes search data cache and resource index database status cache. The search data cache includes a search request, search resources corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resources. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resources.

[0053] Optionally, multiple cached data (cache entries) can be cached locally in the electronic device. Among them, the cached data can include search data cache and resource index database status cache. The search data cache includes a search request, search resources corresponding to the search request (search results previously obtained through the search Q&A system), and an identifier ID of the resource index database status cache entry corresponding to the search resources. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resources (such as refresh time, number of valid data items, number of invalid data items, etc.).

[0054] Among them, the search data cache mainly records content directly related to the search operation, including the search request, the corresponding search results (search resources corresponding to the search request), and the identifier of the resource index database status cache entry corresponding to the search resources. For example, when a user searches for "travel guide documents", the search data cache will record this search term, the relevant document search results given by the search Q&A system, and the identifier of the resource index database status cache entry corresponding to the relevant document search results.

[0055] Among them, the resource index database status cache is a snapshot of the resource index database status, covering information such as refresh time, number of valid data items, and number of invalid data items. It is closely associated with the search data cache. For the search cache data generated by the same search request, the resource index database status cache can help the system judge the validity of the search results. Continuing with the above example of searching for "travel guide documents", the resource index database status cache will record the status of the index database storing these documents. If a large number of relevant documents are deleted in the index database (i.e., the number of valid data items changes), or the database is re-indexed (the refresh time changes), then by comparing the resource index database status cache with the real-time status, the system can know that the cached search results may be inaccurate, and then perform corresponding processing on the cached data, such as deletion or update.

[0056] In this embodiment, when receiving the current search request, multiple cached data cached locally can be searched based on the current search request, that is, to search whether the current search request is in the multiple cached data.

[0057] In some embodiments, when receiving the current search request, a current search identifier can be generated for the current search request. Among them, the current search identifier is used to uniquely identify the current search request. Then, multiple cached data cached locally are searched based on the current search identifier, that is, to search whether the current search request is in the multiple cached data through the current search identifier. Optionally, the current search request can be concatenated with the current time to form a string, and then the hash value of the overall string is calculated as the unique ID, that is, the current search identifier.

[0058] In some embodiments, the search data cache further includes a search resource scope. That is, the search data cache includes a search request, a search resource corresponding to the search request, a search resource scope, and a resource index database status cache entry identifier corresponding to the search resource. Among them, the search resource scope can be determined when the search resource accesses the index system and remains unchanged. Then, in the case of receiving a current search request, a current search identifier can be generated based on the current search request and the current search resource scope, where the current search identifier is used to uniquely identify the current search request, and the multiple cached data cached locally are searched based on the current search identifier. Optionally, the text of the current search request and the resource text names corresponding to the resource list of the current search resource scope can be concatenated together to form a string, and then the hash value of the overall string is calculated as the uniqueness ID, that is, the current search identifier.

[0059] In some embodiments, the search data cache further includes a search resource scope. That is, the search data cache includes a search request, a search resource corresponding to the search request, a search resource scope, and a resource index database status cache entry identifier corresponding to the search resource. Among them, the search resource scope can be determined when the search resource accesses the index system and remains unchanged. On this basis, the search request and the search resource scope can be stored separately. After that, during cache query, in the search requests with the same search resource scope, text similarity is used to find similar search requests. For the cache entries that meet the similarity threshold, the most similar cache entry is selected as the hit cache entry for subsequent inspection. That is, fuzzy matching of search requests can be implemented in a fuzzy search manner. Optionally, the text similarity implementation method can be a rule-based method such as edit distance or a model-based method such as vector similarity, which is not limited here.

[0060] As an implementable manner, in the case of receiving a current search request, it can be checked whether there is an update in the search question-answering system (such as a large model). Among them, if it is checked that there is an update in the search question-answering system, it indicates that all the previously cached data is invalid, and then all the cached data cached locally is cleared; if it is checked that there is no update in the search question-answering system, the multiple cached data cached locally can be searched based on the current search request.

[0061] Please refer to Figure 2 , optionally, the cached data can include the cache of the large model results or the cache of the local retrieval results. For example, term search result cache, keyword search result cache, vector cache, vector retrieval result cache, local retrieval result cache, etc.

[0062] Among them, the local search result refers to the result after the retrieval of local resources is completed and the retrieval results of each resource within the retrieval scope are fused. These results will subsequently be sent to the large model for refined search;

[0063] Among them, the resource retrieval result refers to the retrieval result of a single resource corresponding to a certain search request, which is the fused retrieval result of the results obtained by retrieval strategies such as keyword retrieval and vector retrieval;

[0064] Among them, the keyword retrieval result refers to the process of segmenting the search request to obtain a list of terms, and then retrieving through the terms; the retrieval results of multiple terms are fused to obtain the keyword retrieval result;

[0065] Among them, the term retrieval result refers to the retrieval result obtained through precise / fuzzy queries using the term and its synonyms, near synonyms, etc.;

[0066] Among them, the vector result cache refers to caching the vectorized result of the query, which can effectively reduce the number of calls to the embedding model;

[0067] Among them, the vector retrieval result refers to the retrieval result retrieved by vector similarity;

[0068] Through the above solution, an effective caching system can be formed, covering all aspects of local search, which can further improve the resource search efficiency and cache utilization rate, and effectively reduce the usage cost and search latency.

[0069] Step S130: If a target cache data including a search request matching the current search request is found from the multiple cache data, determine the change situation of the target resource index database status corresponding to the target search resource included in the target cache data.

[0070] In this embodiment, during the process of searching the multiple cache data cached locally based on the current search request, it can be detected whether a cache data including a search request matching the current search request can be found from the multiple cache data.

[0071] Among them, if cached data including a search request that matches the current search request is found among multiple cached data, it can be considered that the same or similar search request has been received before, and the search result corresponding to the search request has been obtained through the search Q&A system and cached locally. That is, when the search result corresponding to the current search request is cached locally at this time, the matching cached data can be used as the target cached data. It can be understood that since each cached data includes a search data cache, and the search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource, then the target cached data can be understood to include a target search request, a target search resource corresponding to the target search request, and a target resource index database status cache item identifier corresponding to the target search resource, and the target search resource corresponds to the target resource index database.

[0072] In some embodiments, if cached data including a search request that exactly matches the current search request is found among multiple cached data, the cached data can be determined as the target cached data; or, if cached data including a search request with a text similarity to the current search request reaching a similarity threshold is found among multiple cached data, the cached data can be determined as the target cached data.

[0073] In some embodiments, when determining the target cached data from multiple cached data, the change situation of the target resource index database status corresponding to the target search resource included in the target cached data can be determined to process the search result cached locally.

[0074] As an implementation manner, when determining the target cached data from multiple cached data, based on the resource index database status cache item identifier included in the target cached data, the change situation of the target resource index database status corresponding to the target search resource included in the target cached data can be determined.

[0075] Step S140: Process the target cached data based on the change situation.

[0076] In this embodiment, when determining the change situation of the target resource index database status corresponding to the target search resource included in the target cached data, the target cached data can be processed based on the change situation.

[0077] Optionally, the change situation may include a change or no change. Then, when determining the change situation of the target resource index database state corresponding to the target search resource included in the target cache data, if it is determined based on the change situation that the target resource index database state has changed, the target cache data can be subjected to a first process; if it is determined based on the change situation that the target resource index database state has not changed, the target cache data can be subjected to a second process, where the first process and the second process are different.

[0078] The search cache processing method provided by an embodiment of the present application first searches multiple cache data cached locally based on the current search request when receiving the current search request. Among them, the cache data includes a search data cache and a resource index database state cache. The search data cache includes a search request, a search resource corresponding to the search request, and a resource index database state cache item identifier corresponding to the search resource. The resource index database state cache is a snapshot of the resource index database state corresponding to the search resource. Then, if a target cache data including a search request that matches the current search request is found from the multiple cache data, the change situation of the target resource index database state corresponding to the target search resource included in the target cache data is determined. Finally, based on the change situation, the target cache data is processed, so that the cache data can be processed according to the state change of the resource index database, and then the search results can be effectively cached to reduce the call frequency of the question-answering system, reduce the usage cost, and at the same time can effectively reduce the search latency and improve the user experience.

[0079] Please refer to Figure 3 , Figure 3 which shows a schematic flowchart of the search cache processing method provided by an embodiment of the present application. The following will elaborate in detail on the Figure 3 flow shown. The search cache processing method may specifically include the following steps:

[0080] Step S210: Load part of the cache data from the multiple cache data in the cache database into the memory cache.

[0081] In this embodiment, when the system starts up, the local cache can be initialized, and part of the cache data from the multiple cache data in the cache database is loaded into the memory cache. It can be understood that at this time, the cache database includes all cache data, and the memory cache includes part of the cache data among all cache data, that is, the cache data in the memory cache is a subset of the cache data in the cache database.

[0082] In some embodiments, the last access time corresponding to each of the multiple cached data in the cache database can be determined, and part of the cached data can be loaded from the multiple cached data in the cache database into the memory cache in the order from the latest to the earliest last access time. That is, the memory cache can be mainly used to store the recently accessed cached data. Optionally, the number of part of the cached data loaded into the memory cache can be determined according to the size of the memory, or can be manually set by the user, etc., which is not limited herein.

[0083] Among them, since the memory cache has a relatively fast access speed, but the cache space is relatively small and the number of data entries that can be cached is small, the memory cache can be mainly used to store the recently accessed cached data; while the cache database has a relatively slow access speed, but the cache space is relatively large and can store more cached data, so the cache database can be used to store all the original cached data. Through the two-level cache method of memory cache - cache database, a better balance can be achieved between the query speed and the number of caches, thereby improving the overall cache effect.

[0084] In some embodiments, since the number of search resources is relatively limited, when loading part of the cached data (including search data cache and resource index database status cache) into the memory cache, all valid resource index database status caches can be loaded into the memory cache to obtain the best access speed.

[0085] Step S220: Receive the current search request.

[0086] For the specific description of step S220, please refer to step S110 and will not be elaborated here.

[0087] Step S230: Search for multiple cached data in the memory cache based on the current search request, where the cached data includes search data cache and resource index database status cache, the search data cache includes a search request, search resources corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resources, and the resource index database status cache is a snapshot of the resource index database status corresponding to the search resources.

[0088] In this embodiment, when the current search request is received, multiple cached data in the memory cache can be searched based on the current search request. That is, it can be detected whether the current search request is in the memory cache.

[0089] As an implementable manner, upon receiving a current search request, a current search identifier can be generated based on the current search request, and multiple cached data in the memory cache can be searched based on the current search identifier. That is, it can be detected whether the current search request is in the memory cache through the current search identifier.

[0090] Step S240: If the target cached data is not found in the memory cache, multiple cached data in the cache database are searched based on the current search request, where the multiple cached data in the memory cache are a subset of the multiple cached data in the cache database.

[0091] Optionally, searching multiple cached data in the memory cache based on the current search request can obtain a first search result, where the first search result can include: the current search request is in the memory cache (that is, there is target cached data in the memory cache whose included search request matches the current search request), or the current search request is not in the memory cache (that is, there is no target cached data in the memory cache whose included search request matches the current search request).

[0092] Among them, if it is searched that the current search request is in the memory cache, that is, the target cached data is found in the memory cache, the change situation of the target resource index database status corresponding to the target search resource included in the target cached data can be determined to process the target cached data.

[0093] Among them, if it is searched that the current search request is not in the memory cache, that is, the target cached data is not found in the memory cache, multiple cached data in the cache database can be searched based on the current search request.

[0094] As an implementable manner, in the case where the target cached data is not found in the memory cache, a current search identifier can be generated based on the current search request, and multiple cached data in the cache database can be searched based on the current search identifier. That is, it can be detected whether the current search request is in the cache database through the current search identifier.

[0095] Among them, during the process of searching multiple cached data in the cache database based on the current search identifier, the expired cached data in the cache database can be filtered to reduce the search volume and improve the search speed.

[0096] Optionally, searching multiple cached data in the cache database based on the current search request may obtain a second search result, where the second search result may include: the current search request is in the cache database (i.e., there is target cached data in the cache database whose included search request matches the current search request), or the current search request is not in the cache database (i.e., there is no target cached data in the cache database whose included search request matches the current search request).

[0097] Wherein, if it is searched that the current search request is in the cache database, that is, target cached data is searched from the cache database, the change situation of the target resource index database state corresponding to the target search resource included in the target cached data may be determined to process the target cached data.

[0098] Wherein, if it is searched that the current search request is in the cache database, that is, target cached data is searched from the cache database, the target cached data may be loaded into the memory cache. Optionally, if the number of memory caches has reached the maximum value, the cached data with the earliest last access time in the memory cache may be deleted from the memory cache, and the target cached data may be loaded into the memory cache.

[0099] Wherein, if it is searched that the current search request is not in the cache database, that is, target cached data is not searched from the cache database, the current search request may be processed by searching the question and answer system.

[0100] Step S250: If target cached data whose included search request matches the current search request is searched from the multiple cached data, determine the change situation of the target resource index database state corresponding to the target search resource included in the target cached data.

[0101] Step S260: Process the target cached data based on the change situation.

[0102] For the specific descriptions of steps S250 - S260, please refer to steps S130 - S140, which will not be elaborated here.

[0103] The search cache processing method provided by an embodiment of the present application, compared with Figure 1 the shown search cache processing method, in this embodiment, multiple cached data in the memory cache are first searched based on the current search request. If target cached data is not searched from the memory cache, then multiple cached data in the cache database are searched based on the current search request, where the multiple cached data in the memory cache are a subset of the multiple cached data in the cache database. Furthermore, by adopting the memory - database two - level cache method, the query time and the mixed cache scale can be effectively balanced, and better cache query timeliness can be obtained.

[0104] Please refer to Figure 4 , Figure 4 which shows a schematic flow chart of a method for processing a search cache provided by an embodiment of the present application. The following will elaborate in detail on the Figure 4 flow shown below. The method for processing the search cache may specifically include the following steps:

[0105] Step S310: Receive the current search request.

[0106] Step S320: Search multiple cached data in the local cache based on the current search request. Among them, the cached data includes search data cache and resource index database status cache. The search data cache includes a search request, search resources corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resources. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resources.

[0107] Step S330: If target cached data including a search request matching the current search request is found from the multiple cached data, determine the change situation of the target resource index database status corresponding to the target search resources included in the target cached data.

[0108] For the specific descriptions of steps S310 - S330, please refer to steps S110 - S130 and will not be elaborated here.

[0109] Step S340: If it is determined based on the change situation that the target resource index database status has changed, delete the target cached data from the local cache and update the resource index database status cache.

[0110] In this embodiment, when determining the change situation of the target resource index database status corresponding to the target search resources included in the target cached data, it may be determined whether the target resource index database status has changed based on this change situation. Among them, if it is determined based on this change situation that the target resource index database status has changed, it may be determined that the target cached data has expired, the target cached data can be deleted from the local cache, and at the same time, the resource index database status cache is updated.

[0111] In some embodiments, if the target cached data is cached in the memory cache and the cache database, the target cached data can be deleted from the memory cache and the target cached data can be deleted from the cache database. If the target cached data is only cached in the cache database, the target cached data can be deleted from the cache database.

[0112] Optionally, deleting the target cache data from the memory cache can be an immediate deletion.

[0113] Optionally, deleting the target cache data from the cache database can be a non-immediate deletion. That is, the target cache data is not immediately deleted from the cache database. Instead, the validity field in the target cache data is marked as invalid. When the preset idle condition is met, the target cache data is deleted from the cache database based on the invalidation mark. This method can effectively avoid time-consuming operations in the cache database, thereby saving processing latency.

[0114] In some embodiments, when the preset idle condition is met, deleting the target cache data from the cache database based on the invalidation mark may include: in the cache maintenance task, deleting the target cache data from the cache database based on the invalidation mark. Among them, the cache maintenance task can be executed when the system is idle (such as when charging and the utilization rate of the central processing unit is lower than the utilization rate threshold), or triggered by a scheduled task (such as in the early morning), or triggered after the resource index maintenance task is completed. The cache maintenance task is mainly used to execute time-consuming database operations and avoid excessive expansion of the cache database, etc., which can effectively improve the timeliness of cache queries. Thus, by separating and placing the time-consuming database operations in the cache maintenance task for execution, time-consuming operations during the cache query process can be avoided, thereby effectively improving the timeliness of cache queries.

[0115] Among them, deleting the target cache data from the cache database based on the invalidation mark can be executed through the following steps:

[0116] 1) Check the validity of the resource index database status cache one by one; compare the resource index database status cache with the real-time resource index database status. If they are inconsistent, it means the resource index database status cache is invalid; update the resource index database status cache;

[0117] 2) Clear the invalid cache data in the cache database corresponding to the resource index database status cache;

[0118] 3) Check the validity of the cache data in the cache database one by one; query the resource status cache entry through the resource status cache entry ID in the cache data; if the ID lookup fails, the corresponding resource status cache entry has been cleared, which means the cache status has been updated and the current cache data is invalid; if the lookup is successful, compare it with the current real-time resource index database status; if they are inconsistent, it means the current index database status has changed and the current cache data is invalid; if they are consistent, continue to check whether the difference between the last access time of the cache data and the current timestamp is less than the set threshold; if the time difference is greater than the set threshold, the cache data is invalid; mark the invalid cache data with an invalidation mark;

[0119] 4) Clear the invalid cache entries in the cache database;

[0120] 5) If the number of cache entries in the cache database exceeds the maximum value, delete the oldest cache entry (the one with the largest difference between the last access time and the current time) until the cache quantity meets the requirements;

[0121] 6) Update the memory cache based on the cache database.

[0122] In some embodiments, updating the resource index database status cache can delete the original resource index database status cache and insert a new cache data item at the same time. And the ID of the cache data needs to be unique. Even for the same resource index database, they need to be different to facilitate subsequent query and comparison.

[0123] The search cache processing method provided by an embodiment of the present application, compared with Figure 1 the search cache processing method shown, in this embodiment, when it is determined that the target resource index database status corresponding to the target search resource included in the target cache data has changed, the target cache data is deleted from the local cache, and the resource index database status cache is updated to dynamically adjust the cache status in real time according to the status change of the search database on the resource, so as to improve the data caching effect.

[0124] Please refer to Figure 5 , Figure 5 which shows a flowchart of the search cache processing method provided by an embodiment of the present application. The following will elaborate in detail on the Figure 5 flow shown. The search cache processing method may specifically include the following steps:

[0125] Step S410: Receive the current search request.

[0126] Step S420: Search multiple cache data in the local cache based on the current search request. Among them, the cache data includes search data cache and resource index database status cache. The search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resource.

[0127] Step S430: If a target cache data including a search request that matches the current search request is found from the multiple cache data, determine the change situation of the target resource index database status corresponding to the target search resource included in the target cache data.

[0128] For the specific descriptions of steps S410 - S430, please refer to steps S110 - S130, which will not be elaborated here.

[0129] Step S440: If it is determined that the status of the target resource index database has not changed based on the change situation, determine the last access time of the target cache data.

[0130] In this embodiment, when determining the change situation of the status of the target resource index database corresponding to the target search resource included in the target cache data, it is possible to determine whether the status of the target resource index database has changed based on this change situation. Among them, if it is determined that the status of the target resource index database has not changed based on this change situation, the last access time of the target cache data can be determined to continue to detect whether the target cache data has expired.

[0131] Step S450: Determine the time difference between the last access time of the target cache data and the current time.

[0132] In this embodiment, in the case of determining the last access time of the target cache data, the time difference between the last access time of the target cache data and the current time can be determined.

[0133] Optionally, the time difference between the last access time of the target cache data and the current time can be obtained by subtracting the current time from the last access time of the target cache data; or, the time difference between the last access time of the target cache data and the current time can be obtained by subtracting the last access time of the target cache data from the current time, etc., which is not limited here.

[0134] Step S460: Process the target cache data based on the time difference.

[0135] In this embodiment, in the case of determining the time difference between the last access time of the target cache data and the current time, the target cache data can be processed based on this time difference.

[0136] In some embodiments, the electronic device can be pre - set and store a time difference threshold, which is used as a judgment basis for the time difference between the last access time of the target cache data and the current time. Therefore, in this embodiment, in the case of obtaining the time difference between the last access time of the target cache data and the current time, this time difference can be compared with the time difference threshold to determine the magnitude relationship between this time difference and the time difference threshold.

[0137] Among them, if the magnitude relationship between the time difference and the time difference threshold indicates that the time difference is greater than the time difference threshold, it can be determined that the target cache data has expired, and the target cache data can be processed by a first processing method. Optionally, the first processing method may include: deleting the target cache data locally and updating the resource index database status cache.

[0138] Among them, if the magnitude relationship between the time difference and the time difference threshold indicates that the time difference is less than or equal to the time difference threshold, it can be determined that the target cache data is valid, and the target cache data can be processed by a second processing method. Optionally, the second processing method may include: feeding back the target search resource (search result) in the target cache data and updating the last access time of the target cache data.

[0139] As a method, if the time difference is less than or equal to the time difference threshold, it can be determined that the target cache data is valid. Then, the target search resource can be assembled from the target cache data, returned to the foreground application to present the user search result, and the last access time of the corresponding target cache data in the memory cache and the cache database is synchronized and refreshed to the current time.

[0140] The processing method of the search cache provided by an embodiment of the present application, compared with Figure 1 the shown processing method of the search cache, in this embodiment, when it is determined that the status of the target resource index database corresponding to the target search resource included in the target cache data has not changed, the last access time of the target cache data is determined, the time difference between the last access time of the target cache data and the current time is determined, and the target cache data is processed based on the time difference, so as to effectively balance the number of replacement sizes and search results according to the set time difference of the cache.

[0141] Please refer to Figure 6 , Figure 6 which shows a schematic flowchart of the processing method of the search cache provided by an embodiment of the present application. The following will elaborate in detail on the Figure 6 shown process. The processing method of the search cache may specifically include the following steps:

[0142] Step S510: Receive the current search request.

[0143] Step S520: Search for multiple pieces of cached data cached locally based on the current search request, where the cached data includes a search data cache and a resource index database status cache. The search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resource.

[0144] Step S530: If target cache data including a search request matching the current search request is found from the multiple cache data, determine the change situation of the state of the target resource index database corresponding to the target search resource included in the target cache data.

[0145] Step S540: Process the target cache data based on the change situation.

[0146] For the specific descriptions of steps S510 - S540, please refer to steps S110 - S140, which will not be elaborated here.

[0147] Step S550: If the target cache data is not found from the multiple cache data or it is determined based on the change situation that the state of the target resource index database has changed, send the current search request to the search and question - answering system.

[0148] In this embodiment, if cache data including a search request matching the current search request is not found from the multiple cache data, it can be considered that the same or similar search request has not been received before, or the search result corresponding to this search request has not been cached locally through the search and question - answering system. That is, at this time, the search result corresponding to the current search request is not cached locally. Then, the current search request can be sent to the search and question - answering system to obtain a search result by processing the current search request through the search and question - answering system.

[0149] In this embodiment, if it is determined based on the change situation that the state of the target resource index database has changed, it can be considered that the target cache data cached locally is invalid, and the target search resource in the target cache data cannot be used as a ready search result for feedback. Therefore, the current search request can be sent to the search and question - answering system to obtain a search result by processing the current search request through the search and question - answering system.

[0150] Optionally, the search and question - answering system may include a large - model.

[0151] Step S560: Receive the search result feedback by the search and question - answering system.

[0152] In this embodiment, after receiving the current search request, the search and question - answering system can process the current search request to obtain a search result and feedback the search request to the electronic device. Correspondingly, the electronic device can receive the search result feedback by the search and question - answering system.

[0153] Step S570: Feedback the search result and add the search result to the local cache.

[0154] In this embodiment, when receiving the search results fed back by the search and question-answering system, the search results can be fed back and added to the local cache.

[0155] As a way, when receiving the search results fed back by the search and question-answering system, return to the foreground application to present the search results, and add the search results to the memory cache and the cache database.

[0156] Optionally, if the number of local caches (such as memory cache and / or cache database) has reached the maximum value, the cache data with the earliest last access time in the local cache can be deleted from the memory cache, and the cache data determined based on the search results can be loaded into the local cache.

[0157] The method for processing search cache provided by an embodiment of the present application, compared with Figure 1 the shown method for processing search cache, in this embodiment, when the target cache data cannot be searched from multiple cache data or it is determined that the status of the target resource index database corresponding to the target search resource included in the target cache data has not changed, the current search request is sent to the search and question-answering system, the search results fed back by the search and question-answering system are received, the search results are fed back, and the search results are added to the local cache, so as to obtain the search results through the search and question-answering system when the search results cannot be obtained locally, to ensure the success rate of question answering, and further improve the user experience.

[0158] Please refer to Figure 7 , Figure 7 which shows a schematic flowchart of the method for processing search cache provided by an embodiment of the present application. The following will elaborate in detail on the Figure 7 shown process. The method for processing search cache may specifically include the following steps:

[0159] Step S610: Receive the current search request.

[0160] Step S620: Search for multiple cache data in the local cache based on the current search request, where the cache data includes search data cache and resource index database status cache. The search data cache includes a search request, a search resource corresponding to the search request, and a cache item identifier of the resource index database status corresponding to the search resource. The resource index database status cache is a snapshot of the status of the resource index database corresponding to the search resource.

[0161] For the specific descriptions of steps S610 - S620, please refer to steps S110 - S120, which will not be elaborated here.

[0162] Step S630: If a target cache data including a search request matching the current search request is found from the multiple cache data, query in the resource index database status cache through the target resource index database status cache entry identifier corresponding to the target search resource included in the target cache data.

[0163] In this embodiment, during the process of searching for multiple cache data cached locally based on the current search request, it can be detected whether a cache data including a search request matching the current search request can be found from the multiple cache data.

[0164] Among them, if a cache data including a search request matching the current search request is found from the multiple cache data, the matching cache data can be determined as the target cache data, and query in the resource index database status cache through the target resource index database status cache entry identifier corresponding to the target search resource included in the target cache data. That is, query the cache status of the corresponding target search resource through the target resource index database status cache entry identifier included in the target cache data.

[0165] It can be understood that in the cache mechanism, each cache data is associated with a resource index database status cache entry identifier, which is used to find the corresponding resource status information in the resource index database status cache. When the system needs to check whether the resource index database status corresponding to a certain cache data has changed, it can query in the resource index database status cache through this resource index database status cache entry identifier. Therefore, corresponding to this embodiment, when the target cache data is determined, the cache status of the corresponding target search resource can be queried in the resource index database status cache through the target resource index database status cache entry identifier included in the target cache data.

[0166] Step S640: If the target resource index database status cache entry identifier is not found in the resource index database status cache, it is determined that the target resource index database status has changed.

[0167] In this embodiment, during the process of querying in the resource index database status cache through the target resource index database status cache entry identifier, it can be detected whether the target resource index database status cache entry identifier is found in the resource index database status cache.

[0168] Among them, if the target resource index database status cache entry identifier is not found in the resource index database status cache, it indicates that the target resource index database status cache entry identifier is not in the resource index database status cache, meaning that the target resource index database status cache has expired, that is, it is determined that the target index database status has changed. It can be understood that under normal circumstances, as long as the cached data is valid, the corresponding resource index database status cache entry identifier should be found in the resource index database status cache. However, the non-existence of the target resource index database status cache entry identifier is most likely due to some changes in the resource index database, such as the deletion of resources, re-indexing, or changes in related configurations, resulting in the update or removal of the corresponding status cache information. Therefore, at this time, it can be determined that the target resource index database status has changed.

[0169] Step S650: If the target resource index database status cache entry identifier is found in the resource index database status cache, then compare the target resource index database status with the current resource index database status corresponding to the target search resource.

[0170] In this embodiment, during the process of querying in the resource index database status cache through the target resource index database status cache entry identifier, it can be detected whether the target resource index database status cache entry identifier is found in the resource index database status cache.

[0171] Among them, if the target resource index database status cache entry identifier is found in the resource index database status cache, it indicates that the target resource index database status cache entry identifier is in the resource index database status cache, then the target resource index database status can be compared with the current resource index database status corresponding to the target search resource. It can be understood that although the target resource index database status cache entry identifier is in the resource index database status cache, after the previous caching, the resource index database status may still change. For example, the number of data items in the resource index database may change due to the addition of new data or the deletion of old data, or the refresh time of the resource may also be updated. Therefore, this embodiment sets the target resource index database status to be compared with the current resource index database status corresponding to the target search resource. If the two are inconsistent, it indicates that the resource index database status has changed; if the two are consistent, it means that the resource index database status has not changed since the last caching.

[0172] Step S660: If the target resource index database status is inconsistent with the current resource index database status, then determine that the target resource index database status has changed.

[0173] In this embodiment, when comparing the state of the target resource index database with the current state of the resource index database, a comparison result can be obtained.

[0174] Among them, if the comparison result indicates that the state of the target resource index database is inconsistent with the current state of the resource index database, it can be determined that the state of the target resource index database has changed; if the comparison result indicates that the state of the target resource index database is consistent with the current state of the resource index database, it can be determined that the state of the target resource index database has not changed.

[0175] Step S670: Process the target cache data based on the change situation.

[0176] For the specific description of step S670, please refer to step S140 and will not be elaborated here.

[0177] The processing method of the search cache provided by an embodiment of the present application, compared with Figure 1 the processing method of the search cache shown, in this embodiment, the target resource index database state cache item identifier corresponding to the target search resource included in the target cache data is also used to query in the resource index database state cache. If the target resource index database state cache item identifier is not found in the resource index database state cache, it is determined that the state of the target resource index database has changed. If the target resource index database state cache item identifier is found in the resource index database state cache, the state of the target resource index database is compared with the current state of the resource index database corresponding to the target search resource. If the state of the target resource index database is inconsistent with the current state of the resource index database, it is determined that the state of the target resource index database has changed, thereby improving the accuracy of the determined change situation of the resource index database state.

[0178] Next, a complete process applicable to the processing method of the search cache provided by the embodiment of the present application will be described.

[0179] Please refer to Figure 8 , Figure 8 which shows a complete process applicable to the processing method of the search cache provided by the embodiment of the present application. As Figure 8 shown, the processing method of the search cache may include the following steps:

[0180] 1) When the system starts, load the latest partial cache data from the cache database into the memory cache; synchronously load the latest index database state cache into the memory cache;

[0181] 2) When receiving a search request from a user, generate a unique queryID by combining the search request with the specified retrieval resource range;

[0182] 3) Check whether there is an update for the search Q&A system version; if there is an update, clear all cached data and go to step 0;

[0183] 4) Retrieve whether the current search request exists in the memory cache through the queryID;

[0184] 5) If the memory cache hits, go to step 0;

[0185] 6) If the memory cache misses, continue to retrieve whether the current search request exists in the cache database through the queryID (filter out expired cached data items);

[0186] 7) If the cache database hits, add the cache entry to the memory cache and go to step 0;

[0187] 8) If the cache database misses, go to step 0;

[0188] 9) Check whether the status of the resource index database corresponding to the search resources of the cached data has changed;

[0189] 10) If the status of the index database of a certain resource has changed, the cache entry becomes invalid, and the cache entry is deleted from the memory cache and the cache database; at the same time, update the status cache of the index database;

[0190] 11) If the cache entry becomes invalid, go to step 0;

[0191] 12) If the status of the resource index database corresponding to all resources has not changed, continue to check whether the difference between the last access time of the cache entry and the current timestamp is less than the set threshold;

[0192] 13) If the time difference is greater than the set threshold, the cache entry becomes invalid; delete the corresponding cache entry from the memory and the cache database and go to step 0;

[0193] 14) If the cache entry is valid, assemble the search results through the cache results, return the search results to the foreground application for presenting to the user; and synchronously refresh the memory cache so that the last access time of the corresponding cache entry in the cache database is the current time; the process ends;

[0194] 15) If the cache misses or the cache becomes invalid, send the search query to the search Q&A system;

[0195] 16) After the search Q&A system obtains the search results, add the search results to the memory cache and the cache database; at the same time, return the search results to the foreground application for presenting to the user.

[0196] Please refer to Figure 9 , Figure 9 which shows the module block diagram of the processing device for search cache provided by an embodiment of the present application. The following will be directed to Figure 9The description is made with reference to the block diagram shown. The processing device 200 for the search cache may include: a search request receiving module 210, a cached data search module 220, a change situation determination module 230, and a cached data processing module 240, where:

[0197] The search request receiving module 210 is configured to receive a current search request.

[0198] The cached data search module 220 is configured to search for multiple cached data in the local cache based on the current search request. Among them, the cached data includes a search data cache and a resource index database status cache. The search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource. The resource index database status cache is a snapshot of the resource index database status corresponding to the search resource.

[0199] Further, the cached data search module 220 includes: a memory cache search sub-module and a first cache database search sub-module, where:

[0200] The memory cache search sub-module is configured to search for multiple cached data in the memory cache based on the current search request.

[0201] The first cache database search sub-module is configured to, if the target cached data is not found in the memory cache, search for multiple cached data in the cache database based on the current search request. Among them, the multiple cached data in the memory cache is a subset of the multiple cached data in the cache database.

[0202] Further, the cached data search module 220 includes: a cached data loading sub-module, where:

[0203] The cached data loading sub-module is configured to load part of the cached data from the multiple cached data in the cache database into the memory cache.

[0204] Further, the cached data loading sub-module includes: a last access time determination unit and a cached data loading unit, where:

[0205] The last access time determination unit is configured to determine the last access time corresponding to each of the multiple cached data in the cache database.

[0206] The cached data loading unit is configured to load part of the cached data from the multiple cached data in the cache database into the memory cache in the order from the latest to the earliest according to their respective corresponding last access times.

[0207] Further, the cache data search module 220 includes: a target cache data loading sub-module, where:

[0208] The target cache data loading sub-module is configured to load the target cache data into the memory cache if the target cache data is searched from the cache database.

[0209] Further, the cache data search module 220 includes: a search identifier generation sub-module and a second cache data search sub-module, where:

[0210] The search identifier generation sub-module is configured to generate a current search identifier based on the current search request and the current search resource range, where the current search identifier is used to uniquely identify the current search request.

[0211] The second cache data search sub-module is configured to search for multiple cached data cached locally based on the current search identifier.

[0212] The change situation determination module 230 is configured to determine the change situation of the target resource index database state corresponding to the target search resource included in the target cache data if the target cache data including a search request matching the current search request is searched from the multiple cached data.

[0213] Further, the change situation determination module 230 includes: a query sub-module and a first determination sub-module, where:

[0214] The query sub-module is configured to query in the resource index database state cache through the target resource index database state cache item identifier corresponding to the target search resource included in the target cache data.

[0215] The first determination sub-module is configured to determine that the target resource index database state has changed if the target resource index database state cache item identifier is not queried in the resource index database state cache.

[0216] Further, the change situation determination module 230 includes: a comparison sub-module and a second determination sub-module, where:

[0217] The comparison sub-module is configured to compare the target resource index database state with the current resource index database state corresponding to the target search resource if the target resource index database state cache item identifier is queried in the resource index database state cache.

[0218] The second determination sub-module is configured to determine that the target resource index database state has changed if the target resource index database state is inconsistent with the current resource index database state.

[0219] The cache data processing module 240 is configured to process the target cache data based on the change situation.

[0220] Further, the cache data processing module 240 includes: a target cache data deletion sub-module, where:

[0221] The target cache data deletion sub-module is configured to, if it is determined based on the change situation that the state of the target resource index database has changed, delete the target cache data from the local cache and update the state cache of the resource index database.

[0222] Further, the target cache data deletion sub-module includes: a first target cache data deletion unit and a second target cache data deletion unit, where:

[0223] The first target cache data deletion unit is configured to, if the target cache data is cached in the memory cache and the cache database, delete the target cache data from the memory cache and delete the target cache data from the cache database.

[0224] The second target cache data deletion unit is configured to, if the target cache data is cached in the cache database, delete the target cache data from the cache database.

[0225] Further, the first target cache data deletion unit and / or the second target cache data deletion unit includes: an invalidation flag sub-unit and a target cache data deletion sub-module, where:

[0226] The invalidation flag sub-unit is configured to mark the validity field of the target cache data as invalid.

[0227] The target cache data deletion sub-unit is configured to, under the condition of meeting the preset idle condition, delete the target cache data from the cache database based on the invalidation flag.

[0228] Further, the cache data processing module 240 includes: a last access time determination sub-module, a time difference determination sub-module, and a cache data processing sub-module, where:

[0229] The last access time determination sub-module is configured to, if it is determined based on the change situation that the state of the target resource index database has not changed, determine the last access time of the target cache data.

[0230] The time difference determination sub-module is configured to determine the time difference between the last access time of the target cache data and the current time.

[0231] The cache data processing sub-module is used to process the target cache data based on the time difference.

[0232] Further, the cache data processing sub-module includes: a first update unit and a second update unit, where:

[0233] The first update unit is used to delete the target cache data from the local cache and update the resource index database status cache if the time difference is greater than the time difference threshold.

[0234] The second update unit is used to feedback the target search resource in the target cache data and update the last access time of the target cache data if the time difference is less than or equal to the time difference threshold.

[0235] Further, the processing device 200 of the search cache further includes: a search request sending module, a search result receiving module, and a search result adding module, where:

[0236] The search request sending module is used to send the current search request to the search question and answer system if the target cache data is not searched from the multiple cache data or it is determined that the status of the target resource index database has changed based on the change situation.

[0237] The search result receiving module is used to receive the search result feedback by the search question and answer system.

[0238] The search result adding module is used to feedback the search result and add the search result to the local cache.

[0239] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

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

[0241] In addition, in each embodiment of the present application, the functional modules can be integrated into one processing module, or each module can exist physically alone, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules.

[0242] Please refer to Figure 10, which shows a structural block diagram of an electronic device 100 provided by an embodiment of the present application. The electronic device 100 may be an electronic device capable of running application programs, such as a smart phone, a tablet computer, an e-book, etc. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, where one or more application programs may be stored in the memory 120 and configured to be executed by one or more processors 110, and one or more programs are configured to execute the methods described in the foregoing method embodiments.

[0243] Among them, the processor 110 may include one or more processing cores. The processor 110 connects various parts within the entire electronic device 100 through various interfaces and lines, and executes various functions of the electronic device 100 and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 110 may integrate one or several combinations of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing objects to be displayed; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 110 and may be implemented separately through a communication chip.

[0244] The memory 120 may include random access memory (RAM), and may also include read-only memory. The memory 120 can be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing functions (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the following method embodiments, etc. The data storage area may also store data created during the use of the electronic device 100 (such as phone book, audio and video data, chat record data, etc.).

[0245] Please refer to Figure 11, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program code is stored in the computer-readable medium 300, and the program code can be called by a processor to execute the method described in the above method embodiment.

[0246] The computer-readable storage medium 300 can be an electronic memory such as a flash memory, EEPROM (electrically erasable programmable read-only memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 300 has a storage space for the program code 310 that executes any method step in the above method. These program codes can be read from or written into one or more computer program products. The program code 310 can be compressed in an appropriate form, for example.

[0247] In summary, for the method, device, electronic device, and storage medium for processing a search cache provided by the embodiments of the present application, first, when receiving a current search request, search multiple cached data in the local cache based on the current search request, where the cached data includes a search data cache and a resource index database status cache. The search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource. The resource index database status cache is a snapshot of the status of the resource index database corresponding to the search resource. Then, if target cached data including a search request matching the current search request is found from the multiple cached data, determine the change situation of the target resource index database status corresponding to the target search resource included in the target cached data. Finally, based on the change situation, process the target cached data, so that the cached data can be processed according to the status change of the resource index database, thereby effectively caching search results, reducing the call frequency of the question-and-answer system, reducing the usage cost, and at the same time effectively reducing the search latency and improving the user experience.

[0248] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing a search cache, characterized in that: The method comprises: Receive the current search request; Searching multiple cached data in the local cache based on the current search request, wherein the cached data includes a search data cache and a resource index database status cache, the search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource, and the resource index database status cache is a snapshot of the resource index database status corresponding to the search resource; If target cache data including a search request matching the current search request is found from the multiple cache data, then a change in the target resource index database state corresponding to the target search resource included in the target cache data is determined; Based on the change, the target cache data is processed.

2. The method according to claim 1, characterized in that The searching of the multiple cached data in the local cache based on the current search request includes: Searching multiple cache data in the memory cache based on the current search request; If the target cache data is not found in the memory cache, multiple cache data in the cache database are searched based on the current search request, wherein the multiple cache data in the memory cache are subsets of the multiple cache data in the cache database.

3. The method according to claim 2, characterized in that Before searching the multiple cache data in the memory cache based on the current search request, the method further includes: Load part of cache data from the multiple cache data in the cache database into the memory cache.

4. The method according to claim 3, characterized in that The step of loading part of the cache data from the cache data in the cache database into the memory cache comprises: Determine the last access time corresponding to each of the plurality of cache data in the cache database; Loading part of the cache data from the plurality of cache data in the cache database into the memory cache in the order of their corresponding last access times from latest to earliest.

5. The method according to claim 2, characterized in that: After searching the plurality of cache data in the cache database based on the current search request, the method further includes: If the target cache data is found from the cache database, the target cache data is loaded into the memory cache.

6. The method according to claim 1, characterized in that The processing of the target cache data based on the change includes: If it is determined based on the change that the state of the target resource index database has changed, the target cache data is deleted from the local cache, and the resource index database state cache is updated.

7. The method according to claim 6, characterized in that The deleting the target cache data from the local cache includes: If the target cache data is cached in the memory cache and the cache database, deleting the target cache data from the memory cache, and deleting the target cache data from the cache database; or If the target cache data is cached in the cache database, the target cache data is deleted from the cache database.

8. The method according to claim 7, characterized in that The deleting the target cache data from the cache database includes: Marking the validity field of the target cache data as invalid; When a preset idle condition is met, the target cache data is deleted from the cache database based on an invalidation mark.

9. The method according to claim 1, characterized in that: The processing of the target cache data based on the change includes: If it is determined based on the change that the state of the target resource index database has not changed, determining the last access time of the target cache data; Determine the time difference between the last access time of the target cache data and the current time; The target cache data is processed based on the time difference.

10. The method according to claim 9, characterized in that The processing of the target cache data based on the time difference includes: If the time difference is greater than the time difference threshold, deleting the target cache data from the local cache and updating the resource index database status cache; or If the time difference value is less than or equal to the time difference threshold, the target search resource in the target cache data is fed back, and the last access time of the target cache data is updated.

11. The method according to any one of claims 1 to 10, characterized in that: The method further comprises: If the target cache data is not found in the plurality of cache data or if it is determined based on the change that the state of the target resource index database has changed, the current search request is sent to the search question-answering system; Receiving search results fed back by the search question and answer system; The search result is fed back and added to the local cache.

12. The method according to any one of claims 1 to 10, characterized in that: The determining of a change in a target resource index database state corresponding to a target search resource included in the target cache data includes: Querying in the resource index database state cache through a target resource index database state cache item identifier corresponding to the target search resource included in the target cache data; If the target resource index database state cache item identifier is not found in the resource index database state cache, it is determined that the target resource index database state has changed.

13. The method according to claim 12, characterized in that The method further comprises: If the target resource index database state cache item identifier is found in the resource index database state cache, the target resource index database state is compared with the current resource index database state corresponding to the target search resource; If the target resource index database state is inconsistent with the current resource index database state, it is determined that the target resource index database state has changed.

14. The method according to any one of claims 1 to 10, characterized in that: The searching data cache further includes searching resource scope, and the searching of multiple cached data in the local cache based on the current search request includes: Generate a current search identifier based on the current search request and the current search resource scope, wherein the current search identifier is used to uniquely identify the current search request; A search is performed on multiple cache data in the local cache based on the current search identifier.

15. A search cache processing device, characterized in that: The device comprises: A search request receiving module, used for receiving a current search request; A cache data search module, used to search multiple cache data in the local cache based on the current search request, wherein the cache data includes a search data cache and a resource index database status cache, the search data cache includes a search request, a search resource corresponding to the search request, and a resource index database status cache item identifier corresponding to the search resource, and the resource index database status cache is a snapshot of the resource index database status corresponding to the search resource; a change determination module, configured to determine a change in a target resource index database state corresponding to a target search resource included in the target cache data if target cache data including a search request matching the current search request is found from the multiple cache data; The cache data processing module is used to process the target cache data based on the change.

16. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is coupled to the processor, and the memory stores instructions. When the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 14.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 14.