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

Can allocator.find() specify the pool to find? #25

Closed
tangliisu opened this issue Jul 26, 2021 · 1 comment
Closed

Can allocator.find() specify the pool to find? #25

tangliisu opened this issue Jul 26, 2021 · 1 comment

Comments

@tangliisu
Copy link
Contributor

A dumb question, in the base allocate function, we need to specify the pool_id (cache->allocate(pool_id, key, size)). Does it means we allow different pool has same keys (for example pool1 has key "foo", pool2 can also have key "foo")?

If we allow same key in different pool, in find function, I found we can only find the cache by key.
ItemHandle find(Key key, AccessMode mode = AccessMode::kRead);
I didn't find any find function and find the cache by key and pool_id. Is that not supported?

@haowu14
Copy link
Contributor

haowu14 commented Jul 27, 2021

Does it means we allow different pool has same keys (for example pool1 has key "foo", pool2 can also have key "foo")?

Nope. Both pools would share the same key space. Assuming you allocate an item in pool1 with "foo" and insert that into the cache; then allocate item pool2 with "foo" again, this item will have to be inserted with insertOrReplace because it is the same key.

@haowu14 haowu14 closed this as completed Jul 30, 2021
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