seoscribe / jsearch

jsearch: a drop-in library for client-side search if you don't have a back-end.
BSD 3-Clause Clear License
2 stars 1 forks source link

Cache search index #8

Closed wnda closed 7 years ago

wnda commented 7 years ago

Once the search index has been retrieved, it is stored in memory as long as the user remains on the same page, but chances are that the user will move around — so it would be good to store the index in localStorage with a timestamp and have it expire after a day or two. We could open the expiration time in the public method so that users can adjust the expiration time of the cache to match the frequency with which the website content is updated/added to.