-
-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cast Error when using DistributedCache #744
Comments
Managed to fix the issue with the following changes to Deserialize in DistributedCache. A bit of a hack, but hopefully gives you guys an idea of where the problem is :-)
|
Thanks for investigating the issue further! We'll take a look at it. Regards |
Thank you, Håkan! I think I may have found a better solution for you. It seems as if the SiteMapping is cached as a List object, but when it's retrieved from the cache in SiteService, it specifies IList... I was able to solve the issue by changing Hope this helps :-) |
I get (more or less) the same error when I try to use RedisCache (from Microsoft.Extensions.Caching.StackExchangeRedis) or even the default Distributed Memory Cache (services.AddDistributedMemoryCache), which is just an in-memory implementation. Specifically, I get
or sometimes in When i use RedisCache I can see that the data has been written to Redis, but it can't retrieve it. Has anyone got DistributedCache working? I'm using the latest Piranha version (8.1.0). |
I will see if I can replicate the error on the |
So I have looked into the problem and apparently how models are loaded have changed a bit since the distributed cache was written. Also, unfortunately we don't run any integration tests on distributed cache, only on memory cache which I will look into, otherwise we would've caught the problem earlier. For those of you that need distributed caching while we try to resolve the issue, I've created a gist that contains an alternate distributed cache that doesn't use binary formatting, instead it serializes objects using https://gist.github.com/tidyui/95c441293af55f9eb906ba756ae398e5 Best regards |
@tidyui Thanks, I'll try that until this is sorted out! 👍 |
Hi!
I'm just testing out the DistributedCache with SQL Server. I've created a Cache DB and table with ...
dotnet sql-cache create "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=DistCache;Integrated Security=True;" dbo TestCache
... and wired everything up in my Startup.cs by adding ...
services.AddDistributedSqlServerCache(options =>
{
options.ConnectionString = Configuration["DistCache_ConnectionString"];
options.SchemaName = "dbo";
options.TableName = "TestCache";
});
services.AddPiranhaDistributedCache();
.. to ConfigureServices(), and ...
App.CacheLevel = Piranha.Cache.CacheLevel.Full;
to Configure().
When I first load up my site everything works perfectly. I check my cache table and everything is in there, so I know writing to the cache works and all is (hopefully) configured OK.
When I refresh my page (now getting from the cache) I get the following error...
I've tried debugging and a few different options, however I'm a bit lost - was hoping I could try and figure out what was going wrong but no luck unfortunately.
I also tried out the same on 6.1.0 but I got the same error.
If you need anymore info please let me know.
Thanks!
The text was updated successfully, but these errors were encountered: