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

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