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

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