/// <summary> /// Adds new cache item to cache. If another item already exists with the same key, that item is removed before /// the new item is added. If any failure occurs during this process, the cache will not contain the item being added. /// Items added with this method will not expire, and will have a Normal priority. /// </summary> /// <param name="key">A key of the item to be put to the cache.</param> /// <param name="value">Value to be stored in the cache. It may be null.</param> /// <param name="options">The options <see cref="CachePutOptions"/> to use when making a request.</param> public void Put(string key, object value, CachePutOptions options) { Guard.ArgumentNotNullOrEmptyString(key, "key"); Guard.ArgumentNotNull(options, "options"); if (options.EnableAsyncPut) { Task.Factory.StartNew(() => { this.cacheManager.Add(key, value, options.Priority, options.RefreshAction, options.ExpirationPolicy); }); } else { this.cacheManager.Add(key, value, options.Priority, options.RefreshAction, options.ExpirationPolicy); } }
public void Put(string key, object value, CachePutOptions options) { _cacheClient.Put(key, value, options); LogPut(key, value, options); }
private void LogPut(string key, object value, CachePutOptions options) { LogItem("put", options.Region, key, value); }
/// <summary> /// Puts the specified object into the cache at the specified key, /// using the specified options. /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <param name="options"></param> public void Put(string key, object value, CachePutOptions options) { _provider.Put(_cacheId, key, value, options); }
private void LogPut(string key, object value, CachePutOptions options) { LogItem("put", options != null ? options.Region : null, key, value); }
public void Put(string key, object value, CachePutOptions options) { _cache[key] = new ValueOptionsPair { Value = value, Options = options }; }