While testing and investigating/debugging DXA’s distributed (Redis) caching to see how it works, I ran into some issues. The caching code (storing and retrieving) works fine for the plain
PageModel, most of the time (except when it has includes), but never for a custom one. The (custom) Page Model gets successfully stored in Redis, but it’s never retrieved, even though the key and the cache regions match. The code always returns null. And not just that, output caching also doesn’t work, neither for entities, nor pages. Again, the values are stored, but are not retrieved.
During the investigation I have reached the lowest point of the caching which is part of the DXA framework and I saw nothing wrong. After that point, the code calls into the
Get method from the
Sdl.Web.Delivery.Caching which returns null. I suspect there is an issue with deserialization.
I have put together the following table with my test cases:
Screenshot of what is stored in Redis. One more thing to point is that the publication mappings for example are in a readable form, while this (Page Model) data looks like gibberish (actually like hexa, but with various symbols mixed inside):
The snippet of the code and what is returned when
Get is called:
The environment is set in the following way:
DXA 2.2 .NET
DefaultCacheProvider is used in the solution.
Sdl.Web.Delivery package 11.0.1062
This seems like a defect in the SDL.Web.Delivery dll(s), but I want to check just in case, did anyone else experience any issues with Redis cache?
I will also contact SDL support as the problematic method is within a closed library, and if I get a response, I will update the question accordingly.