What happens, is that when you call ctools_object_cache_clear, if you call the _get function in the same instance, the static cache of the get function overrides the information in the database, and you end up with the same cached object as before you cleared the cache.

You can get around this by calling a ctools_object_cache_get($obj, $name, true), after calling ctools_object_cache_clear, but I suggest, for consistencies sake that ctools_object_cache_clear, at least, should do the same.

I have not done any tests with ctools_object_cache_clear_all, but I suspect the problem is likely to recur.

CommentFileSizeAuthor
#1 ctools-objectcache-clear-771132-1.patch472 bytessfyn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sfyn’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
FileSize
472 bytes

Here's a patch against the current dev version that clears the static cache within ctools_object_cache_clear(). Patched from the module root

merlinofchaos’s picture

Status: Active » Needs review

Patch attached, so setting proper status.

sdboyer’s picture

Status: Needs review » Fixed

Fixed, but with a better approach - changed ctools_object_cache_get() to use ctools_static(), allowing the ...clear() and ...clear_all() functions to simply reach directly into the static cache and make the necessary modifications. This keeps a pointless query from being run by the getter, and also prevents the cache from getting into a potentially incorrect state, which would occur on a ctools_object_cache_set() if the approach in the original patch was taken.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.