Comments (5)
Hey @Miggleness - thanks for raising this! Looks like this is caused by 67deced where I was trying to work around a race condition. Will try and work out the best course of action to fix it without re-introducing that race condition.
from cachetower.
I could raise a PR too if you don't already have a fix ready
from cachetower.
Thanks for the offer! I'd normally accept it but I've already dug a bit into it now and have a fix mostly written.
CacheTower/src/CacheTower/CacheStack.cs
Lines 289 to 291 in d251195
The code here is to always return an existing value if it originally thought there was no value (to satisfy the race condition). What it does with previousEntry.Expiry < DateTimeProvider.Now
though implies that logic will also apply for expired entries - it should not be a <
but a >=
to imply returning only non-expired entries.
Can't believe I missed that when I wrote it!
While the fix can be as simple as switching the sign, I'm also looking into whether I switch out the boolean noExistingValueAvailable
for an enum about the status of the entry (stale, expired, miss) as it might make the surrounding code more obvious too.
from cachetower.
cool. i was thinking along the same lines. im not sure sure about the locking part when refreshing
update: i get it now why. might be worth splitting RefreshValueAsync for each of those paths you mentioned.
from cachetower.
Thanks again @Miggleness for raising this and providing a simple drop-in test case for the bug - little things like that make my life a lot easier! I've just released 0.11.6 which includes the fix for this bug.
from cachetower.
Related Issues (20)
- Manually Trigger Background Refresh HOT 2
- Empty list serialized as null when memory and redis cache are used HOT 1
- Implement WaitToFinish strategy HOT 1
- NullReferenceException on blocked task when original task faulted HOT 2
- Investigate Coyote for concurrency testing
- How to Background Refresh work? HOT 3
- Add synchronous methods HOT 1
- JsonFileCacheLayer - Use previous cache on next start HOT 10
- Consider using FASTER HOT 2
- RedisLockExtension Questions HOT 1
- Cache stack builder delegate which provides IServiceProvider HOT 6
- Upgrading from v0.11.x to Custom Serializers with RedisCacheLayer breaks existing caches HOT 32
- Caching layers support atomic operations? HOT 1
- Ability to set CacheSettings depending on the result of the valueFactory HOT 4
- Dependency Dashboard
- Sliding expiries
- Add in-memory provider that uses IMemoryCache
- FileCacheProvider - exception while opening invalid Manifest HOT 1
- CacheStack protected accessors
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 cachetower.