예제 #1
0
파일: Caches.cs 프로젝트: isaveu/Devx
 public static void Insert(IKeyPrefix prefix, string key, object obj, CacheDependency dep = null, CacheItemPriority priority = CacheItemPriority.Normal)
 {
     if (obj != null)
     {
         string realKey = prefix.Prefix + ":" + key;
         CacheContainer.Insert(realKey, obj, dep, prefix.ExpireSeconds <= 0 ? DateTime.MaxValue : DateTime.Now.AddSeconds(prefix.ExpireSeconds), TimeSpan.Zero, priority, null);
     }
 }
예제 #2
0
파일: Caches.cs 프로젝트: isaveu/Devx
        public static object Get(IKeyPrefix prefix, string key)
        {
            string realKey     = prefix.Prefix + ":" + key;
            Object cacheObject = CacheContainer[realKey];

            if (cacheObject != null)
            {
                string oType = cacheObject.GetType().Name.ToString();
                if (oType.IndexOf("[]") > 0)
                {
                    if (((Array)cacheObject).Length == 0)
                    {
                        return(null);
                    }
                    else
                    {
                        return(cacheObject);
                    }
                }
            }
            return(cacheObject);
        }
예제 #3
0
파일: Caches.cs 프로젝트: isaveu/Devx
 public static void Remove(IKeyPrefix prefix, string key)
 {
     CacheContainer.Remove(prefix.Prefix + ":" + key);
 }