meteor-integration icon indicating copy to clipboard operation
meteor-integration copied to clipboard

Add optional user doc caching

Open lorensr opened this issue 9 years ago • 5 comments

Instead of just caching the userId. Configurable cache duration, ability to go through or invalidate.

lorensr avatar May 23 '16 04:05 lorensr

You know what would maybe be even better? Just using an observe on the user IDs to invalidate the cache. Then it's guaranteed to work. Note that Meteor already does this to invalidate currently logged in users when passwords are reset or login tokens deleted:

https://github.com/meteor/meteor/blob/0a402c75376e68c4781bf636bcf3dfd0ae27a045/packages/accounts-base/accounts_server.js#L884-L951

stubailo avatar May 23 '16 17:05 stubailo

Nice, can you repair the cached doc with observed changes, or do you refetch or delete?

On Monday, May 23, 2016, Sashko Stubailo [email protected] wrote:

You know what would maybe be even better? Just using an observe on the user IDs to invalidate the cache. Then it's guaranteed to work. Note that Meteor already does this to invalidate currently logged in users when passwords are reset or login tokens deleted:

https://github.com/meteor/meteor/blob/0a402c75376e68c4781bf636bcf3dfd0ae27a045/packages/accounts-base/accounts_server.js#L884-L951

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/apollostack/meteor-integration/issues/4#issuecomment-221045178

lorensr avatar May 23 '16 18:05 lorensr

I think observe just gives you the whole new document right?

stubailo avatar May 23 '16 18:05 stubailo

Ah, yes – it's observeChanges that only gives the fields

http://docs.meteor.com/api/collections.html

On Monday, May 23, 2016, Sashko Stubailo [email protected] wrote:

I think observe just gives you the whole new document right?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/apollostack/meteor-integration/issues/4#issuecomment-221060252

lorensr avatar May 23 '16 19:05 lorensr

Pseudocode for this: https://github.com/apollostack/meteor-integration/pull/19#issuecomment-228629726

lorensr avatar Jun 30 '16 02:06 lorensr