Reputation: 1021
I set-up the object:
ObjectCache MyCache = new MemoryCache("MyCache");
Trying to use that instance in the future, and I tried this:
ObjectCache MyCache = MemoryCache("MyCache");
But gives an error.
I figured it works, because this code works:
ObjectCache DefaultCache = MemoryCache.Default;
But only lets me use the default cache.
I'm not sure how to use the MyCache
instance I created in the future. How do I do this?
Upvotes: 0
Views: 349
Reputation: 1038710
Once you have created this MyCache
variable instance you could store it as a static property to some class or configure it in your DI framework so that it gets automatically injected to all classes taking an ObjectCache
constructor dependency.
Upvotes: 3