CodeIgniter 4 cache invalidation limits without tagging support
24.6K reputation · 21 Aug 2021, 14:18 UTC
CodeIgniter 4 utilizes a driver-based caching system relying on Time-To-Live (TTL) for data expiration. While the framework supports various backends such as Redis, Memcached, and File, it lacks a native mechanism for tag-based invalidation or group cache clearing.
When underlying database records are updated, the associated cache entries remain stale until their specific TTL expires. Because there is no built-in method to cross-reference database changes with multiple cache keys, developers must manually track individual keys or implement custom naming conventions to maintain consistency.
Is there a documented pattern for implementing bulk invalidation of related keys without manually iterating through every identifier? Additionally, how does the File driver handle potential race conditions or stale reads during high-concurrency write operations before TTL expiration?