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

Last question regarding entry of cache with same key, will the key be overwritten or as in FIFO, pushed backward? #14

Closed
hiqinternational opened this issue Jun 4, 2019 · 2 comments
Labels
question Further information is requested

Comments

@hiqinternational
Copy link

hiqinternational commented Jun 4, 2019

Last question regarding entry of cache with same key e.g. Set(k,v), will the key be

  1. deleted first and then added
    or
  2. as in FIFO, pushed backwards?

if it's 1, i'll leave it as it is.
if it's 2, i would manually use Del(k) first because i want my other old entries to be Get(k) and not evicted when overpopulated.

@valyala
Copy link
Collaborator

valyala commented Jun 6, 2019

All the new entries, including entries with the existing key, are added into circular byte buffer, so it is close to 2. Del(k) won't help, since it doesn't free up space in the circular byte buffer - it just removes k => <offset in the circular buffer> mapping.

@hiqinternational
Copy link
Author

ok thx

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

No branches or pull requests

2 participants