Comments (5)
Hi. Thanks for the suggestion. Wondering why you would want that/what problem it solves as i think that change would make the api less productive? The difference between LazyCache and ObjectCache is that in GetOrAddAsync we accept a delegate, not the actual value, so if we are adding to the cache the value has not been constructed yet. That means if we returned null you would not have a reference to it unless you kept hold of one in your delegate which feels messy to me. Or have I miss understood?
from lazycache.
No reply for a while, closing.
from lazycache.
Hi @alastairtree - it's been a while since I used this. So I can't remember the exact use case.
It was along the lines of something like:
- get item from cache.
- if item doesn't exist, then add to cache.
- now record WHAT happened
the problem is the last step. I don't know if the item was added or just retrieved.
I think that's why I created this issue.
from lazycache.
In that case the "record what happened" code can be done inside the callback as that only gets executed when the item is actually generated for the cache?
from lazycache.
I understand what you're suggesting and think that has merit - I just wondered if I had problems with that when I last tried it?
Sample code or some updated docs with an example?
from lazycache.
Related Issues (20)
- LazyCache.TryGetValue appears to return null value HOT 17
- Create a sectioned IAppCache
- how do I clean the cache items by wildcard of a key HOT 2
- Add TryGetValueAsync that evaluates GetValueFromAsyncLazy HOT 1
- Cache eviction policy when cache is full? HOT 1
- Absolute expiration does not work v2.4.0 HOT 1
- Implement MemoryCache.Trim() to allow explicit removal
- LongRunning shouldn't run more than once HOT 1
- About Cache availability mechanism HOT 2
- CachingService.TryGetValue returning wrong value HOT 2
- Cannot dispose of cache HOT 3
- How to create separate caches? Not seeing how this is done. HOT 1
- Do you have plans to upgrade to dotnet7 HOT 5
- Question/Proposal on the limit of Cache keying to strings vs. "TKey"
- Is it possible to have some kind of management console to show the list of keys and their expiry?
- Bug in Wiki: Why does the Cancellation Tokens example use two CancellationTokenSource?
- Singleton constraint conflict if IMemoryCache already exists
- Is it possible to set the maximum size limit of the LazyCache as is possible in IMemoryCache by MS? HOT 1
- PostEvictionCallBack causing memory leak
- Returning null still successfully adds entry
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 lazycache.