Example #1
0
        private async Task <CacheValue <T> > RedisValueToCacheValueAsync <T>(RedisValue redisValue)
        {
            if (!redisValue.HasValue)
            {
                return(CacheValue <T> .NoValue);
            }
            if (redisValue == _nullValue)
            {
                return(CacheValue <T> .Null);
            }

            try {
                var value = await redisValue.ToValueOfTypeAsync <T>(_serializer).AnyContext();

                return(new CacheValue <T>(value, true));
            } catch (Exception ex) {
                _logger.Error(ex, "Unable to deserialize value \"{redisValue}\" to type {type}", redisValue, typeof(T).FullName);
                return(CacheValue <T> .NoValue);
            }
        }