Comments (4)
Wow, @jodydonetti you did a really good job alone. Thank you bro
from fusioncache.
Hi @viniciusvarzea and thanks for using FusionCache!
Your need, if I got it right, is already taken care of by FusionCache itself when disposing the ServiceProvider
, which usually happens automatically when the host app shuts down.
Basically, since any singleton service registered via DI has been requested at least once, it's the job of the DI container to dispose it, if the class implements IDisposable
or a corresponding interface.
By doing so, any instance of IFusionCache
that has been requested will be disposed, too.
Nitpicking corner (in case you are interested)
The so called "default cache" (meaning the FusionCache instance registered via AddFusionCache()
with the default name) is requested to the service provider via the IFusionCache
interface, so if it has been required even once, it will be automatically disposed.
For the named caches instead (the ones registered via AddFusionCache("name")
with a custom name), what gets registered underneath is a LazyNamedCache
service per each cache, which in turn can provide the actual named cache when asked: this has been done so that I can enumerate all the registered ones internally via a ctor param of type IEnumerable<LazyNamedCache>
and then only if and when asked for one in particular, that cache will be actually instantiated and so, later on, disposed.
In this way if you register 20 different named caches but then only work with 1, you'll only instantiate 1 (and later on automatically dispose it).
Hope this helps.
from fusioncache.
Hello @jodydonetti thank you for the further response. I was worried about the dispose of the cache instances.
Thank you for the excellent project, you guys really rock.
from fusioncache.
Hello @jodydonetti thank you for the further response. I was worried about the dispose of the cache instances.
Good, so I'll close this!
Thank you for the excellent project, you guys really rock.
Thanks, even though "us guys" it's just me 😅
from fusioncache.
Related Issues (20)
- Possibility of creation of a count variable in distributed cache HOT 2
- [FEATURE] Post factory executed event with possibility to change the cache settings before it be inserted in cache HOT 3
- Syncing different cloud instances HOT 5
- [BUG] Value is stored for longer than FailSafeMaxDuration HOT 7
- [BUG] AllowBackgroundDistributedCacheOperations serialization and cache operations seem to be happening in the foreground HOT 3
- best way to store FusionCacheEntryOptions in iConfiguration HOT 3
- Nullable `Size` option HOT 3
- [BUG] Deadlock caused by cancellation of eager refresh HOT 8
- [BUG] Slow Performance of FusionCache compared to Microsoft.Extensions.Caching.Memory.MemoryCache HOT 4
- [BUG] FailSafe max duration is somehow ignored HOT 7
- [FEATURE] Optimise dependencies by adding TFM HOT 9
- 💡 Add this project to awesome-italia-opensource HOT 2
- [BUG] Possible bug. FusionCache + EntityFramework (latest) on ASP NET Core 8 (.NET 8) HOT 16
- [FEATURE] 🔺 Add .NET Aspire support HOT 1
- [FEATURE] 🔑 Add DI Keyed Services support HOT 17
- [FEATURE] Fall back Defaults for adaptive caching HOT 4
- [FEATURE] How about add compress support for large entries in distributed cache ? HOT 3
- [FEATURE] Utilize Microsoft.IO.RecyclableMemoryStream in flavor of creating new MemoryStream instances when serializing HOT 12
- [FEATURE] ⚡ Add `PreferSyncSerialization` option HOT 2
- [FEATURE] Allow the factory to determine the cache duration? HOT 4
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 fusioncache.