Closed quicksketch closed 1 year ago
Looks like it's partially related to wildcard flushes, but the bigger problem is that because the states
cache is stored in the default cache
bin, any other caches in the default bin don't track their wildcard (or temporary cache clear timestamps) because we have an if statement in reloadVariables()
:
// Only reload variables if state system is available.
if (backdrop_static('states')) {
$this->wildcard_flushes = state_get('memcache_wildcard_flushes', array());
$this->cache_flush = state_get('memcache_flush_' . $this->bin, 0);
$this->cache_temporary_flush = state_get('memcache_temporary_flush_' . $this->bin, 0);
$this->flushed = min($this->cache_flush, REQUEST_TIME);
}
The D7 module uses variables to store this information and it seemed that states was a good alternative, but now I'm not sure that's a good idea either. Because states uses a cache, we can't really depend on it since checking state while retrieving the state cache causes a recursion loop.
Seems like just using memcache directly to store the cache clear times would be the best solution. While we can't depend on memcache always persisting the value 100% of the time (since it may get removed when space is low), the LRU (least recently used) algorithm should prioritize these memcache-module-owned entries as very recently used, since we'll need them every single request. I'll work up a PR.
Fixed in https://github.com/backdrop-contrib/memcache/pull/2 by using memcache itself instead of the database or state system.
When using memcache module beta1, the cache for the theme registry seems to never clear. This causes problems like new templates not being picked up.
This may be because clearing the theme cache is cleared via
backdrop_theme_rebuild()
, which usescache()->deletePrefix('theme_registry')
. So the cache entries are not deleted, they're tracked via states that a wildcard flush has occurred on that key.