• Consistent: clears the existing cache every time the index is updated, which ensures up-to-date results but impacts performance for frequently changing indexes.
• Time-based: keeps a query in cache for N seconds, this generates a new cache to create a continuous update of the cache at the risk of the occasional stale result.
Warm-Up Queries
Each query cache also includes the option to define warm-up queries for popular searches, which are automatically loaded into cache:
• When the search server starts.
• After each index update (consistent query caches only).
• Every N seconds (time-based query caches only).
Sample Use Case
Imagine you have a search application that displays a sales dashboard for a chain of retail stores. Executives frequently want an overview of financial trends that includes all the stores in their search results. However, individual store managers want to see the latest sales figures for their store only.
In such a case, you could create two caches:
• One to store user queries in a consistent cache.
• Another to store warm-up queries in a time-based cache.
Create and Manage a Query Cache
Create a Query Cache
You can add multiple query caches to the same command.
1. In the Administration Console, go to Search > Search API.
2. Under Commands, select /search-api > Search cache.
3. Under Search cache, click Add search cache and create one of the following:
◦ Consistent: creates a new cache every time the index is updated.
◦ Time-based: keeps a query in cache for N seconds.
4. (Optional) Under warm-up queries, define one or more queries to cache automatically.
◦ Enter the query and any parameters as they appear in the search URL.
◦ For example, to search for "new york city" while restricting the search to the sl0 search logic, enter: q=new%20york%20city&logic=sl0