How content caching works
# help-with-umbraco
d
Hello! I have a question that might be quite basic, but I can't find a precise description, so I apologize if there is any obvious documentation for this. I'm curious about how content caching works in Umbraco 13.1.0. From what I've found, there's an in-memory cache and a local cache. What processes does Umbraco go through exactly? I assume it first checks the in-memory cache, and if it doesn't find the data there, it moves to the local cache. What happens if the data isn't there either? Does it then query the database? I looked at the source code (https://github.com/umbraco/Umbraco-CMS/releases/tag/release-13.0.1), but I didn't find any fallback solution indicating it would query the database. I'm also interested in when the in-memory cache and the local cache are populated. Is there a way for me to request the keys or contents of these caches? Thank you!
s
Content cache is only in memory and loads when Umbraco starts.
https://umbraco.com/products/knowledge-center/roadmap/ Support for lazy-loaded cache is coming, likely in v15
d
If file storage is turned off, where does it load the data from? (I assume it's from the database, but I would like to validate this to be sure).
s
It loads it on startup from NuCache (file based). Of course if the cache file doesn't exist it has to be retrieved from the database.
d
Thank you for the previous answers. Yes, this seems to be the obvious answer to me as well, that in such cases the request goes to the database to fill the in-memory cache, but I haven't found any code parts indicating this here: https://github.com/umbraco/Umbraco-CMS/releases/tag/release-13.0.1. I am probably missing an obvious code part or looking in the wrong place. Could you perhaps point me in the direction of where I can find the code related to this, or send specific code that handles this? Thank you in advance.
s
I don't really know without looking at the code. Can I ask what the reason is you'd like a deeper look into that?
d
We have an application running on Azure deployment (where backoffice and scale are separate). There are 4 instances of the scale. We are experiencing that the backoffice always returns the data correctly, but the scale is behaving inconsistently. When we publish some content, it initially returns the content with a 200 status, but after some time, we increasingly receive 404 errors. We suspect that the in-memory cache might be getting corrupted, and we are trying to figure out how it updates and receives the data. Additionally, we had the hypothesis of bypassing the local cache and going directly to the database, so we thought about disabling the local cache and testing the functionality, but unfortunately, we are still encountering the issue.
s
Going directly to the database is a huge performance hit and will not make you happy. Instead of doing workarounds that are unsupported and never been done by anyone before, make sure to set it up as per the documentation. You should follow the documentation and set it up just like that (and triple-check that the setup is as described 😅 ) https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/load-balancing / https://docs.umbraco.com/umbraco-cms/fundamentals/setup/server-setup/load-balancing/azure-web-apps
d
Thank you, @Sebastiaan, for your help. We found the issue in the meantime. It wasn't entirely with the load balancing or our caching. The problem was that nodes with the same name in different languages were not handled correctly. Instead of being created with a multi-language solution, they were created individually, which led to the inconsistent behavior.
65 Views