Based on the provided information it seems like that the cache key expires 
before the key is retrieved from the cache. The Deserialize method is only 
called when Redis returns a non empty value for the given key:
https://github.com/nhibernate/NHibernate-Caches/blob/master/StackExchangeRedis/NHibernate.Caches.StackExchangeRedis/AbstractRegionStrategy.cs#L173
Make sure that the expiration time (default 300 seconds) is long enough for 
your needs.

Dne četrtek, 14. februar 2019 13.14.16 UTC+1 je oseba Risto Haikonen 
napisala:
>
> Hi all,
>
> I am using new 2nd level cache provider and decided to use non-default 
> serializer, like one below
>
>  internal class MySerializer: CacheSerializerBase
>         {
>             public override byte[] Serialize(object value)
>             {
>                 using (var ms = new MemoryStream())
>                 {
>                     Serializer.Serialize(ms, value);
>                     return ms.ToArray();
>                 }
>             }
>
>             public override object Deserialize(byte[] data)
>             {
>                 throw new Exception("HAHA"); //Never thrown!
>                 using (var ms = new MemoryStream(data))
>                 {
>                     var res = Serializer.Deserialize<object>(ms);
>                     return res;
>                 }
>             }
>         }
>
> I succesfully gave it to RedisCacheConfiguration, but when debugging, i 
> noticed Serialize method is called as expected, while putting data to Redis.
> But Deserialize gets never called here. Everything (in quite complex 
> system with many mappings) works fine nevertheless, data is received and 
> used in application normally. Am i doing something wrong here?
>
> Risto
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to