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

How to get all values in cache? #1

Closed
LMS5413 opened this issue Dec 23, 2023 · 1 comment
Closed

How to get all values in cache? #1

LMS5413 opened this issue Dec 23, 2023 · 1 comment

Comments

@LMS5413
Copy link

LMS5413 commented Dec 23, 2023

Im using this package and i have a doubt. How to get all values saved in cache?

@eluneevermore
Copy link
Owner

eluneevermore commented Dec 24, 2023

This package doesn't have any function to get all cached value at the moment. You have to use redis commands.

If you are using the cache command, you may want to use a prefix for your cache:
const cache = new Cache(new Redis({ keyPrefix: "foo:" }))
Then either use cache.redis.keys or cache.redis.scan to get all keys with your prefix, then use them as argument for cache.getManyCache.

If you are using the hashCache command, you can use cache.redis.hgetall and parse the cached values by yourself.

Btw, I wonder why do you need to get cached values without knowing their keys?

@eluneevermore eluneevermore closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
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