meteor-feature-requests icon indicating copy to clipboard operation
meteor-feature-requests copied to clipboard

Caching prior subscriptions on the client

Open Twisterking opened this issue 7 years ago • 1 comments

So I am really not sure if a feature like this is already implemented so if it is - please just drop a little hint here and close this issue!

The problem: In my app I have a "search" publication, which I subscribe to with a current "search query" coming from a standard search field. The server then returns the appropriate items from a collection matching this search query (using a standard Mongo find with a Regex). In my app this search field is very frequently used and it is not uncommon, that a similar search query is often entered multiple times within seconds. --> so why not cache the results of these search query subscriptions on the client?

The solution: I stumbled across ZangoDB today, a MongoDB-like interface for HTML5 IndexedDB ... which got me thinking if this could be used to achieve a simple "cache" for all kinds of mongo results and maybe even query them on the client further. Using HTML5 IndexedDB this DB could be persistent for X amount of time.

Please drop me a line if you think this might be a bad idea or whatever, just putting it out there ... I think having some easy way to cache results of subscriptions on the client would be a great feature and, if used correctly, could speed up many apps as many round trips to the server to receive data could be avoided.

Twisterking avatar Oct 26 '17 21:10 Twisterking

@Twisterking I think this package works just fine:

https://github.com/ccorcos/meteor-subs-cache

If it also solves your use case, please close this issue!

KoenLav avatar Apr 13 '19 22:04 KoenLav