I am trying to create a new Sitecore 9.0.1 XP cache and add an item to it. I can create the cache just fine. When I call the Add method it executes just fine but nothing is added to the cache.
I have a local variable call viewCache
private readonly ICache<string> viewCache;
I have tried to do both of this.
this.viewCache = Sitecore.Caching.CacheManager.GetNamedInstance<string>( "viewCache", 10, true); // Also tried this instead of the above line. NOT both at the same time this.viewCache = new Cache("viewCache", 10);
Both execute just fine and create a cache object.
Later on I make this call.
Again it executes just fine. However, when I look at the cache the count is always 0 and I can't get the value out of the cache as it says it is null.