When page caching is turned on during automated test runs (see #606840-118: Enable internal page cache by default) some of the failures are in the following test cases: CommentInterfaceTest, JavaScriptTestCase, MenuRouterTestCase, OpenIDFunctionalTestCase, OpenIDInvalidIdentifierTransitionTestCase, SiteMaintenanceTestCase, ThemeDebugMarkupTestCase, UserRegistrationTestCase
These appear to be due to Drupal not clearing caches appropriately when variable_set() is called.
Although variable_set() is a function that shouldn't be called too often, it's probably called often enough that we wouldn't want to do a blanket cache clear of the entire page cache when it happens.
Instead, we could use cache tags to fix this (#636454: Cache tag support). Basically, when a page is being built, track all calls to variable_get() that occurred along the way. If the page is written to the cache at the end of the request, save cache tags associated with those variables. When variable_set() is called, clear the cache only for pages whose cache entries are tagged with that particular variable.
I'm not directly postponing this issue on the backport of that one, but it seems like it would be the best way to solve this.
Comments
Comment #2
wim leersSo, using a PHP
staticto achieve this.What if a cached rendered block used a variable?
I don't see how you can make this work in a remotely reliable way in Drupal 7 without huge disruption.