public T GetCached <T>(string cacheName, Func <T> setterResponse, DateTime cacheUntil) where T : class { var cachedItem = GetCached <T>(cacheName); if (cachedItem != null) { return(cachedItem); } var uncachedResult = setterResponse(); if (IsCacheEnabled()) { MemoryCacheManager.SetItem(cacheName, uncachedResult, cacheUntil); } return(uncachedResult); }
public T GetCached <T>(string cacheName) where T : class { return(IsCacheEnabled() ? MemoryCacheManager.GetItem <T>(cacheName) : null); }