Suggestion: document the use 'cacheSearchResultsFo...
# community-help
e
Suggestion: document the use 'cacheSearchResultsForSeconds'. It is very useful and isn't mentioned in the official docs. I only knew it existed because it was available in the instant search github example. The only other reference to it is at https://giters.com/typesense/typesense-js/issues/52 . Official docs at the moment only discuss server-side caching. I considered editing the docs myself, but wasn't sure where to place it.
c
I’ve been experimenting with having my app proxy the requests to typesense - that way I can cache things there if I want (so the same search results are available to different visitors) and it also moves the query formulation / result translation code away from the client so not as much code + data has to go over the wire.
For an individual user, I use normal http headers / 304 response to cache results via the browser rather than having to create any specific cache mechanism in the client app
j
@Edson Feimberg Yeah, I've been meaning to add client-specific docs to the README... For now, I just point to the Configuration class from the README to learn about all available options.
@CaptainCodeman There's actually both client-side caching and also server-side caching if needed in Typesense
There's the use_cache and cache_ttl search parameters: https://typesense.org/docs/0.22.1/api/documents.html#caching-parameters
c
Yes, I’ve been using the
use_cache
option as well
my thinking is to have each browser re-use matching results when it can (local browser cache), have results re-used between users in the same area when possible (via CDN) and then have Typesense cache things too. It all seems to work well and should scale.
j
Nice! Cache all the way!
c
I’m so cheap - anything to save a $! 😄
j
But caching improves performance as well! So improves UX for users 🙂
As they say, resource constraints actually help build good products!
c
Yes, it does make everything nice and zippy. Honestly, I’m just so happy how well it’s working I can’t wait to launch the site that’s going to use it
🙌 1