/// <summary> /// Inserts or updates an item to cache for the default configured time /// </summary> /// <typeparam name="T">Type of the object to insert or update</typeparam> /// <param name="key">Key of the item</param> /// <param name="value">Object to add/update to cache</param> /// <param name="overwrite">Flag to overwrite or not if already present with the key</param> /// <returns>True, if successfully added/updated</returns> public bool PutItem <T>(string key, object value, bool overwrite = true) { CacheItemPolicy policy = GetDefaultCachePolicy(); return(this.PutItem(CacheUtils.GetCacheKey <T>(key), value, policy, overwrite)); }
/// <summary> /// Retrieves a generic item from the cache with the specified key /// </summary> /// <typeparam name="T">Type of cached object to retrieve</typeparam> /// <param name="key">Key of the item</param> /// <returns>Object retrieved</returns> public T GetItem <T>(string key) where T : class { return(privateCache.Get(CacheUtils.GetCacheKey <T>(key)) as T); }