We have moved to GitHub Issues
Created by Shannon Deminick 22 Mar 2013, 15:55:44 Updated by Shannon Deminick 22 Mar 2013, 20:00:34
when updating the dictionary, the cache does not get refreshed in load balanced environments therefore any updates made to the dictionary will not be reflected on other servers until the app domain is restarted on each server.
I have an idea what could be the problem here. We have a similar problem where we develop our umbraco websites locally and then upload to a server.
If we create a dictionary item locally, and then upload the macro that uses the dictionary item, we would notice that the dictionary item isn't shown.
I guess this is because locally, our cache got refreshed after adding the dictionary item. The server on the other hand has no way of knowing it should refresh its cache, so it tests if there is a cache using "EnsureCache()", which there is, so it tries to retrieve the item, which isn't found because it isn't cached yet.
Now, the question is how do you go about solving this ... Perhaps query the database on a cache miss ...
Normally when you publish to your live site you'd refresh the app pool, then you wouldn't need to worry about that. I'm not sure what you mean by: "If we create a dictionary item locally, and then upload the macro that uses the dictionary item, we would notice that the dictionary item isn't shown." - are you sharing the database between your local environment and your published one ?
Yes, we are sharing the database in certain instances ... So it's in the database, but not in the cache on the live server.
I'd probably recommend to not share the live database with your development, that is a pretty specialized setup that would be very difficult to support. You will have problems with much more than just dictionary caching if you are doing this. The only way for all servers to be notified of cache changes is to setup load balancing and add each server to the list in the configuration. Otherwise you'll need to reset the app pool on the live server to ensure your 'local' changes are reflected.
I think the only good way to solve this is:
And this fix should be applied to every kind of cache (Content, Dictionary, ...)
We're in the painful process of streamlining cache and making it consistent. It is proving to be very tedious. I agree that cache needs to be handled very differently moving forward but we need to take baby steps here :)
Nice to hear you're working on it. If you want, I could up a simple solution like this?
the code for cache handling will be changing quickly over the next few pushes so I'd wait until we finish streamlining how this all works. Eventually all cache handling will be done through the ApplicationContext.Current.ApplicationCache. Currently that is just a helper to access the HttpRuntime cache but it will be extended to support all sorts of cache (in memory, static, runtime, etc...) and will automatically support callbacks to lookup from the source if there is a cache hit miss.
This is fixed in revision ff07b46066cd - the fix only pertains to ensuring that cache is refreshed on all distributed servers that are configured for load balancing.
Assignee: Shannon Deminick
Backwards Compatible: True
Affected versions: 4.8.0, 4.9.0, 4.10.0, 4.11.0, 6.0.0, 4.9.1, 4.11.1, 4.11.2, 4.11.3, 4.11.4, 6.0.1, 4.11.5, 6.0.2
Due in version: 6.1.0