//------------------------------------------------------------------------------------------------------------------ private void WriteToCache <T>(CacheInfo cacheInfo, ApiResponse <T> response) { if (cacheInfo.Write && cacheInfo.CacheTimeMin > 0 && response.Status.Ok && response.Data != null) { if (cacheInfo.IsSerialized) { var serializedData = _serializer.Serialize(response.Data); _cache.Set(cacheInfo.CacheKey, serializedData, cacheInfo.CacheTimeMin); } else { _cache.Set(cacheInfo.CacheKey, response.Data, cacheInfo.CacheTimeMin); } } }
public TestCache SetAppCache([FromBody] TestCache testCache) { _appCache.Set(testCache.CacheKey, testCache.Value); return(testCache); }
public String SetAppCache() { _appCache.Set("test", "Test App Cache", 3); return("Application Cache Set"); }