Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using express session as backend? #34

Open
jasonkarns opened this issue Sep 19, 2016 · 1 comment
Open

Using express session as backend? #34

jasonkarns opened this issue Sep 19, 2016 · 1 comment

Comments

@jasonkarns
Copy link

jasonkarns commented Sep 19, 2016

Just curious if anyone has attempted using an express request session as a backend. The sessions are already memcached, and leveraging the session would save a memcached call since the session will have already been hydrated before cached calls. I admit, it's a rather odd use case. Especially considering the weirdness for a Cache's backend to essentially be swapped out (as a single Cache would have its backend "swapped" for each request).

But curious if anyone else has attempted to use cached wherein a specific backend instance is supplied for each Cache method call.

@jkrems
Copy link
Contributor

jkrems commented Sep 19, 2016

Interesting idea! I'm not aware of anyone doing that (yet). It might be possible to do it generically for "external object backed", e.g. an in-memory backend with "bring your own object".

The downside of "It's just one cache operation!" is that everything has to fit into one cache value. Which can become problematic for memcache in particular.

Maybe a "transaction mode" for caches would be a better fit for this problem (assuming it's not all data that's super small & user-specific)? E.g. some form of cache.multiGetOrElse has already been proposed in other places. It might also be possible to collect set operations and bulk them up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants