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.
Comment | File | Size | Author |
---|---|---|---|
#1 | ctools-objectcache-clear-771132-1.patch | 472 bytes | sfyn |
Comments
Comment #1
sfyn CreditAttribution: sfyn commentedHere's a patch against the current dev version that clears the static cache within ctools_object_cache_clear(). Patched from the module root
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedPatch attached, so setting proper status.
Comment #3
sdboyer CreditAttribution: sdboyer commentedFixed, but with a better approach - changed
ctools_object_cache_get()
to usectools_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 actools_object_cache_set()
if the approach in the original patch was taken.