コード例 #1
0
        /// <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);
            }
        }
コード例 #2
0
 public void Put(string key, object value, CachePutOptions options)
 {
     _cacheClient.Put(key, value, options);
     LogPut(key, value, options);
 }
コード例 #3
0
 private void LogPut(string key, object value, CachePutOptions options)
 {
     LogItem("put", options.Region, key, value);
 }
コード例 #4
0
 /// <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);
 }
コード例 #5
0
ファイル: DefaultCacheClient.cs プロジェクト: nhannd/Xian
		/// <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);
		}
コード例 #6
0
		public void Put(string key, object value, CachePutOptions options)
		{
			_cacheClient.Put(key, value, options);
			LogPut(key, value, options);
		}
コード例 #7
0
		private void LogPut(string key, object value, CachePutOptions options)
		{
			LogItem("put", options != null ? options.Region : null, key, value);
		}
コード例 #8
0
 public void Put(string key, object value, CachePutOptions options)
 {
     _cache[key] = new ValueOptionsPair {
         Value = value, Options = options
     };
 }