U4-7816 - The IsolatedCache instance in the RepositoryFactory differs from the ApplicationContext singleton instance

Created by Shannon Deminick 22 Jan 2016, 15:34:14 Updated by Claus Jensen 25 Jan 2016, 09:42:05

This basically means that if you clear the isolated caches from the ApplicationContext singleton that the caches are not in fact cleared. This generally will only cause issues when clearing all of the caches but could have some other unwanted repercussions with cache refreshing.

Comments

Shannon Deminick 22 Jan 2016, 15:37:37

The main issue - which is due to overlooking that the ApplicationCache gets created in the WebBootManager, is that the WebBootManager didn't create an ApplicationCache instance that used DeepCloneRuntimeCacheProvider. This meant that the RepositoryFactory would create it's own wrappers for this, since Umbraco requires the DeepCloneRuntimeCacheProvider to work. Normally this would work but what we were doing was entirely replacing the instance of IsolatedRuntimeCache (which contains the cache dictionary), so now the ApplicationContext singleton cache pointed to a different instance of the IsolatedRuntimeCache. The items returned were fine since we wrapped it, but if you removed things from the dictionary (ie. ClearCaches), this is a different dictionary than what the RepositoryFactory used.

To Fix:

  • Made the WebBootManager create the cache helper correct - this means that it never gets wrapped, so they are always the same instances
  • In the case where the RepositoryFactory needs to make adjustments (i.e. if people are using this code direclty in their unit tests or something), we no longer create a new instance, we just set the factory on the instance to what it should be


Shannon Deminick 22 Jan 2016, 15:37:54

rev: f78a42598552f7ee0c7dc6d545acf53bb7dacdb0


Claus Jensen 25 Jan 2016, 09:41:59

Great :)


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.3.6

Sprint: Sprint 7

Story Points:

Cycle: