colour.utilities.CACHE_REGISTRY#
- colour.utilities.CACHE_REGISTRY = <colour.utilities.common.CacheRegistry object>#
Provide a registry for managing mapping-based caches.
The registry maintains a collection of named caches that can be registered, cleared, and unregistered. Each cache operates as a dictionary-like mapping for storing key-value pairs.
Attributes
Methods
register_cache()unregister_cache()clear_cache()clear_all_caches()
Examples
>>> cache_registry = CacheRegistry() >>> cache_a = cache_registry.register_cache("Cache A") >>> cache_a["Foo"] = "Bar" >>> cache_b = cache_registry.register_cache("Cache B") >>> cache_b["John"] = "Doe" >>> cache_b["Luke"] = "Skywalker" >>> print(cache_registry) {'Cache A': '1 item(s)', 'Cache B': '2 item(s)'} >>> cache_registry.clear_cache("Cache A") >>> print(cache_registry) {'Cache A': '0 item(s)', 'Cache B': '2 item(s)'} >>> cache_registry.unregister_cache("Cache B") >>> print(cache_registry) {'Cache A': '0 item(s)'} >>> print(cache_b) {}