Beispiel #1
0
        public object Get(string key, CacheGetOptions options)
        {
            object value = _cacheClient.Get(key, options);

            LogGet(key, value, options);
            return(value);
        }
Beispiel #2
0
        /// <summary>
        /// Returns the value associated with the given key.
        /// </summary>
        /// <param name="key">A key of the item to return from cache.</param>
        /// <param name="options">The options <see cref="CacheGetOptions"/> to use when making a request.</param>
        /// <returns>The value stored in the cache.</returns>
        public object Get(string key, CacheGetOptions options)
        {
            Guard.ArgumentNotNullOrEmptyString(key, "key");
            Guard.ArgumentNotNull(options, "options");

            object value = this.cacheManager.GetData(key);

            if (options.AutoRemove)
            {
                Remove(key);
            }

            return(value);
        }
 internal object DoGet(bool isPublic, string key, CacheGetOptions getOptions)
 {
     object obj2;
     CacheKey cacheKey = new CacheKey(key, isPublic);
     CacheEntry entry = this.UpdateCache(cacheKey, null, false, CacheItemRemovedReason.Removed, out obj2);
     if (entry == null)
     {
         return null;
     }
     if ((getOptions & CacheGetOptions.ReturnCacheEntry) != CacheGetOptions.None)
     {
         return entry;
     }
     return entry.Value;
 }
Beispiel #4
0
        internal object DoGet(bool isPublic, string key, CacheGetOptions getOptions)
        {
            CacheKey   cacheKey = new CacheKey(key, isPublic);
            object     obj;
            CacheEntry cacheEntry = this.UpdateCache(cacheKey, null, false, CacheItemRemovedReason.Removed, out obj);

            if (cacheEntry == null)
            {
                return(null);
            }
            if ((getOptions & CacheGetOptions.ReturnCacheEntry) != CacheGetOptions.None)
            {
                return(cacheEntry);
            }
            return(cacheEntry.Value);
        }
 internal object Get(string key, CacheGetOptions getOptions);
Beispiel #6
0
 internal object Get(string key, CacheGetOptions getOptions)
 {
     return(this.DoGet(false, key, getOptions));
 }
Beispiel #7
0
        internal object DoGet(bool isPublic, string key, CacheGetOptions getOptions) {
            CacheEntry  entry;
            CacheKey    cacheKey;
            object      dummy;

            cacheKey = new CacheKey(key, isPublic);
            entry = UpdateCache(cacheKey, null, false, CacheItemRemovedReason.Removed, out dummy);
            if (entry != null) {
                if ((getOptions & CacheGetOptions.ReturnCacheEntry) != 0) {
                    return entry;
                }
                else {
                    return entry.Value;
                }
            }
            else {
                return null;
            }
        }
Beispiel #8
0
 internal object Get(string key, CacheGetOptions getOptions) {
     return DoGet(false, key, getOptions);
 }
Beispiel #9
0
 internal object Get(string key, CacheGetOptions getOptions) {
     return _cacheInternal.DoGet(true, key, getOptions);
 }
Beispiel #10
0
 public object Get(string key, CacheGetOptions getOptions)
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
        private void LogGet(string key, object value, CacheGetOptions options)
        {
            string action = value == null ? "miss" : "hit";

            LogItem(action, options.Region, key, value);
        }
Beispiel #12
0
 public object Get(string key, CacheGetOptions getOptions)
 {
     throw new NotImplementedException();
 }
Beispiel #13
0
 /// <summary>
 /// Gets the object at the specified key from the cache, or null if the key does not exist.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public object Get(string key, CacheGetOptions options)
 {
     return(_provider.Get(_cacheId, key, options));
 }
Beispiel #14
0
		/// <summary>
		/// Gets the object at the specified key from the cache, or null if the key does not exist.
		/// </summary>
		/// <param name="key"></param>
		/// <param name="options"></param>
		/// <returns></returns>
		public object Get(string key, CacheGetOptions options)
		{
			return _provider.Get(_cacheId, key, options);
		}
		public object Get(string key, CacheGetOptions options)
		{
			object value = _cacheClient.Get(key, options);
			LogGet(key, value, options);
			return value;
		}
		private void LogGet(string key, object value, CacheGetOptions options)
		{
			string action = value == null ? "miss" : "hit";
			LogItem(action, options != null ? options.Region : null, key, value);
		}
Beispiel #17
0
            public object Get(string key, CacheGetOptions options)
            {
                ValueOptionsPair value;

                return(_cache.TryGetValue(key, out value) ? value.Value : null);
            }
Beispiel #18
0
 internal object Get(string key, CacheGetOptions getOptions)
 {
     return(_cacheInternal.DoGet(true, key, getOptions));
 }