Esempio n. 1
0
        /// <inheritdoc />
        public TV Get <TK, TV>(TK key) where TV : class
        {
            if (_memoryCache.TryGetValue(key, out TV output))
            {
                return(output);
            }

            output = _distributedCache.GetJson <TV>(key.ToString());
            if (output != null)
            {
                _usedKeys.Add(key);
                _memoryCache.Set(key, output, _slidingExpiry);
            }
            return(output);
        }
Esempio n. 2
0
        public V Get <K, V>(K key) where V : class
        {
            V output = null;

            if (memoryCache.TryGetValue(key, out output))
            {
                return(output);
            }
            else
            {
                output = distributedCache.GetJson <V>(key.ToString());
                if (output != null)
                {
                    usedKeys.Add(key);
                    memoryCache.Set(key, output, slidingExpiry);
                }
                return(output);
            }
        }
Esempio n. 3
0
 public V Get <K, V>(K key) where V : class
 {
     return(distributed.GetJson <V>(key.ToString()));
 }
Esempio n. 4
0
 /// <inheritdoc />
 public TV Get <TK, TV>(TK key) where TV : class
 {
     return(_distributed.GetJson <TV>(key.ToString()));
 }