Example #1
0
        public static CacheBody <T> GetInstance()
        {
            if (_instance == null)
            {
                lock (locker)
                {
                    if (_instance == null)
                    {
                        _instance = new CacheBody <T>();
                    }
                }
            }

            return(_instance);
        }
Example #2
0
 public static void Update <T>(string key, T value, int expireSec = 0)
 {
     CacheBody <T> .GetInstance().Update(key, value, expireSec);
 }
Example #3
0
 public static T GetOrCreate <T>(string key, Func <T> create, int expireSec = 0)
 {
     return(CacheBody <T> .GetInstance().GetOrCreate(key, create, expireSec));
 }
Example #4
0
 public static void Remove <T>(string key)
 {
     CacheBody <T> .GetInstance().Remove(key);
 }
Example #5
0
 public static IEnumerable <string> GetAllKey <T>()
 {
     return(CacheBody <T> .GetInstance().GetAllKey());
 }
Example #6
0
 public static T Get <T>(string key)
 {
     return(CacheBody <T> .GetInstance().Get(key));
 }
Example #7
0
 public static string Get(string key)
 {
     return(CacheBody <string> .GetInstance().Get(key));
 }
Example #8
0
 public static bool ContainsKey <T>(string key)
 {
     return(CacheBody <T> .GetInstance().ContainsKey(key));
 }
Example #9
0
 public static void Add <T>(string key, T value, int expireSec = 0)
 {
     CacheBody <T> .GetInstance().Add(key, value, expireSec);
 }