AI OnAI Off
Hi!
You need to override that SetCacheSettings method instead of calling it yourself. In AddContentToCache, default cache settings are created, and then SetCacheSettings is called so you can modify default settings if needed. Something like this:
protected override void SetCacheSettings(IContent content, CacheSettings cacheSettings)
{
// For sliding expiration
cacheSettings.SlidingExpiration = TimeSpan.FromMinutes(1);
cacheSettings.AbsoluteExpiration = System.Web.Caching.Cache.NoAbsoluteExpiration;
// For absolute expiration
cacheSettings.SlidingExpiration = System.Web.Caching.Cache.NoSlidingExpiration;
cacheSettings.AbsoluteExpiration = DateTime.UtcNow.AddMinutes(1);
}
I have tried to set a cache timeout in Content Provider,
I have used the below methods,
Method 1: Set the cache setting before adding the content to cache
Method 2: Set the cache settings after adding the content to cache
Above methods have no impact. It stays in the cache. If this is not the proper way, is there a way to set the cache timeout?
Or is it possible delete the content provider cache on demand?