mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-10-04 09:01:41 +02:00
555 B
555 B
Auto-Balanced Cache (By Popularity)
You need to initialize the cache and its limit during the creation of the index:
const index = new Index({ cache: 100 });
const results = index.searchCache(query);
A common scenario for using a cache is an autocomplete or instant search when typing.
When passing a number as a limit the cache automatically balance stored entries related to their popularity.
When just using "true" the cache is unbounded and perform actually 2-3 times faster (because the balancer do not have to run).