Hello,
Due to a bug in the way I was calculating the expiration timespan to use when Putting items into a redis backed cache, I started receiving "Specified cast is not valid" exceptions when retrieving the item with the bad expiry time.
This seemed to be triggered if the expiry TimeSpan was a negative value (ie: in the past)
Maybe there should be some guarding against Adding/Putting already expired items, to avoid bad metadata making it into the cache?
Here's the stacktrace:
[InvalidCastException:Specifiedcastis not valid.]StackExchange.Redis.RedisValue.op_Explicit(RedisValuevalue)in RedisValue.cs:443
CacheManager.Redis.<>c__DisplayClass35_0.<GetCacheItemInternal>b__0()+741
CacheManager.Redis.RetryHelper.Retry(Func`1retryme,Int32timeOut,Int32retries,ILoggerlogger)+226
CacheManager.Redis.RedisCacheHandle`1.Retry(Func`1retryme)+149
CacheManager.Redis.RedisCacheHandle`1.GetCacheItemInternal(Stringkey,Stringregion)+347
CacheManager.Redis.RedisCacheHandle`1.GetCacheItemInternal(Stringkey)+46
CacheManager.Core.Internal.BaseCache`1.GetCacheItem(Stringkey)+65
CacheManager.Core.BaseCacheManager`1.GetCacheItemInternal(Stringkey,Stringregion)+234
CacheManager.Core.BaseCacheManager`1.GetCacheItemInternal(Stringkey)+46
CacheManager.Core.Internal.BaseCache`1.GetCacheItem(Stringkey)+65
Thanks,
Greg
Hello,
Due to a bug in the way I was calculating the expiration timespan to use when Putting items into a redis backed cache, I started receiving "Specified cast is not valid" exceptions when retrieving the item with the bad expiry time.
This seemed to be triggered if the expiry TimeSpan was a negative value (ie: in the past)
Maybe there should be some guarding against Adding/Putting already expired items, to avoid bad metadata making it into the cache?
Here's the stacktrace:
Thanks,
Greg