moo.core.utils.flush_attribute_caches

moo.core.utils.flush_attribute_caches()

Evict the cross-process verb- and property-lookup caches from Redis.

The moo:verb:* and moo:prop:* keys cache inheritance-resolved lookups (verb PK sets / property values) for MOO_ATTRIB_CACHE_TTL seconds. An object’s own entries are evicted on write, but a descendant’s cached lookup is not — so after a bulk moo_init --sync that adds or relocates verbs/properties on an ancestor, descendants can serve stale lookups until the TTL expires. Flushing gives --sync an immediate refresh across the long-running shell and celery processes without a restart.

The per-process _cached_compile lru_cache is deliberately left alone: it is keyed by verb source text, so changed source yields a new key and a fresh compile automatically.

No-op when the attribute cache is disabled (MOO_ATTRIB_CACHE_TTL == 0, e.g. tests) or the active cache backend is not Redis.

Returns:

the number of keys deleted.