Exemple #1
0
        public static T Get <T>(this ICacheClient2 client, string key)
        {
            T value;

            client.TryGetAsync(key, out value).Wait();
            return(value);
        }
Exemple #2
0
 public static long Decrement(this ICacheClient2 client, string key, uint amount, DateTime expiresAt)
 {
     return(client.IncrementAsync(key, -(int)amount, expiresAt.Subtract(DateTime.Now)).Result);
 }
Exemple #3
0
 public static long Decrement(this ICacheClient2 client, string key, uint amount)
 {
     return(client.IncrementAsync(key, -(int)amount).Result);
 }
Exemple #4
0
 public static long Increment(this ICacheClient2 client, string key, uint amount, TimeSpan expiresIn)
 {
     return(client.IncrementAsync(key, (int)amount, expiresIn).Result);
 }
Exemple #5
0
 public static bool TryGet <T>(this ICacheClient2 client, string key, out T value)
 {
     return(client.TryGetAsync(key, out value).Result);
 }
Exemple #6
0
 public static void RemoveAll(this ICacheClient2 client, IEnumerable <string> keys)
 {
     client.RemoveAllAsync(keys).Wait();
 }
Exemple #7
0
 public static bool Remove(this ICacheClient2 client, string key)
 {
     return(client.RemoveAllAsync(new[] { key }).Result == 1);
 }