Comments (8)
Are the values being returned by Get
corrupted (as in, randomly mutated), or mismatched with other keys? If you can give me a general idea of how you're using it and the exact issue you were running into, I can invest time into this.
from ristretto.
Values returned by Get
are corrupted, but there does not appear to be a consistent pattern and the errors will appear to randomly correct itself.
from ristretto.
@apoggi-carecloud Out of curiosity, does the cached data have anything referenced by pointers? Like slices or maps?
from ristretto.
@johnnyfeng-bread The cached data does contain slices and maps
from ristretto.
I might be wrong but I believe Ristretto places the data as is into a syncmap, which would mean that the original data, the cached copy, and any retrieved copies would all have the same pointer references. So a change to any one of the referenced values would change all of them. My suspicion is that's what's going on here.
from ristretto.
OK, so concurrent access is not safe then.
from ristretto.
Concurrent access should be safe for non-referenced types like strings or numbers. It's more that storing referenced values of any sort is not safe, whether or not it's accessed concurrently. So your data shouldn't include pointers, which means no slices or maps.
This would need someone from the Ristretto team to confirm, as I'm not 100% on the details of how this is implemented.
from ristretto.
Concurrent access to the cache is safe (as in, Get/Set/Del are all atomic operations). Ristretto guarantees that the values returned haven't been corrupted, but if the values are pointers there is no guarantee that the underlying data hasn't been mutated (if something else holds the pointer).
If enough people need a "transaction"-like API, we can look into adding that, where you can Get-Use-Set in one atomic operation, but for now I don't think we need it.
from ristretto.
Related Issues (20)
- [FEATURE]: Support for Type Parameters, aka, generics HOT 1
- [BUG]: ristretto used about 2 x MaxCost memory?? HOT 5
- benchmark about gc or plan to reduce gc HOT 1
- [BUG]: Expiration map grows without limit HOT 6
- [QUESTION]: Why did you choose ristretto as the project name ? HOT 2
- [FEATURE]: Loading or Compute If key is not present
- How many bits tinyLFU uses to count access frequency? HOT 1
- [QUESTION]: Ristretto hit ratio benchmark result HOT 2
- [BUG]: <sync.Pool GC>
- [QUESTION]: Too high missed rate?
- [FEATURE]: Jemalloc 5.3.0
- [FEATURE]: use system jemalloc
- [Non-hashed key values in Item]: onEvict should send the non hashed key values HOT 1
- [BUG]: compilation reports asm error when -buildmode=plugin
- [QUESTION]: Is there any way to implement an expired map counter with ristretto?
- [QUESTION]: How can I pre warm the cache ?
- [QUESTION]: When get v.0.1.2 tag and it's release note?
- [QUESTION]: Why is Ristretto so slow and has such a small hit ratio?
- Update projects using ristretto
- [SERIOUS BUG]: negative key cache hit problem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ristretto.