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 ensure the LRU cache is thread safe? #22

Open
uran0sH opened this issue Feb 15, 2023 · 3 comments
Open

How to ensure the LRU cache is thread safe? #22

uran0sH opened this issue Feb 15, 2023 · 3 comments

Comments

@uran0sH
Copy link

uran0sH commented Feb 15, 2023

The LRU cache implemented in cache.rs is not thread safe. I'd like to know how you ensure that it is thread-safe

@dermesser
Copy link
Owner

Well as you say, it isn't thread-safe and not made to be. That's why it isn't Sync.

Do you mean to ask how it could be made thread-safe?

@uran0sH
Copy link
Author

uran0sH commented Feb 20, 2023

Yeah. I thought you made sure the LRU cache was thread-safe elsewhere. I wrote a perhaps thread-safe LRU cache. Maybe you can give some advice? https://github.com/uran0sH/dsa-rs/blob/main/src/concurrent_lru.rs

@dermesser
Copy link
Owner

As my cache isn't concurrent, it is built quite differently from yours, so right away I can't give good advice I'm afraid.

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