/// <summary> /// 检查是否包括KEY值 /// </summary> /// <param name="key">KEY值</param> /// <returns></returns> public bool ContainsKey(string key) { if (!IsCache) { return(false); } key = KeyPrefix + key; return(CacheItemDictionary.ContainsKey(key)); }
/// <summary> /// 根据KEY获得缓存值 /// </summary> /// <param name="key">KEY值</param> /// <returns>查找到缓存值</returns> public object Get(string key) { if (!IsCache) { return(null); } key = KeyPrefix + key; if (CacheItemDictionary.ContainsKey(key)) { CacheItem cacheItem = CacheItemDictionary.Get(key); return(SerializationUtility.ToObject(cacheItem.value)); } else { return(null); } }