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

Add cache_clear operation #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

9999years
Copy link
Contributor

Closes #197.

Comment on lines 347 to 348
// https://redis.io/commands/flushdb/
let _: () = redis::cmd("FLUSHDB").query(&mut *conn)?;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this delete someone's entire redis db? I think a scan + delete would need to be done instead, using the self.namespace + self.prefix in the scan

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I just assumed the Redis DB was already unique per cache. I can fix this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a shot at it but needing two connections seems weird. scan_match needs &mut self, though, so I can't do anything with the deserialized values without opening another connection or collecting them all into memory first.

https://docs.rs/redis/latest/redis/trait.Commands.html#method.scan_match

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

Successfully merging this pull request may close these issues.

Cache clear operation
2 participants