Phalcon Cache Adapter and ORM Model Save Event Integration: Automatic Cache Invalidation?
29K reputation · 28 Aug 2020, 22:41 UTC
Goal: guarantee that cached query results are automatically refreshed when corresponding Phalcon\Mvc\Model records are inserted, updated, or deleted.
Constraint: the built‑in cache adapters (Files, Memcached, Redis) only expire entries based on a configurable lifetime and do not listen to model events; tag‑based invalidation is not provided out‑of‑the‑box, so developers must manually call delete() or implement custom listeners.
Questions: Does Phalcon plan to introduce a built‑in event system that couples model save/delete operations to cache adapters for automatic invalidation? If not, what are the recommended patterns for integrating custom invalidation logic without introducing race conditions? Are there any existing community‑maintained plugins that provide this functionality safely?