If you work with the current "master" branch of Doctrine ORM, the ORM itself provides a feature called "Second Level Cache" (or SLC or L2 Cache).
Doctrine ORM 2.5 will be released soon with this feature, you may read more about it at http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/second-level-cache.html If you cannot use 2.5 (master) right now, you may check http://stackoverflow.com/questions/15661296/doctrine-2-and-orm-how-to-cache-every-query-for-some-entity- yes, that's a lot of manual work. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 6 February 2014 13:24, Christian Ebert <ebert.ch...@gmail.com> wrote: > Hi, > > > > I am working on a ZF 2 / Doctrine 2 based application with a traditional > relational MySQL backend. I am trying to figure out how to effectively add > a > caching layer. Concrete I am searching for a solution how to handle > associations effectively. That means if an entity changes e.g. username of > a > user, I need to expire all related caches where the user is used. As it is > a > write intensive backend solution, I cannot specify a fixed amount of time > when the cache should be expired. Moreover I need to expire the caches > immediately when the related data changes. > > > > Is there any clever recommendation how to implement this or is the best > solution to manually define relations between caches and used entities. Of > course manual management of relations is not preferred as this is always > subject to be forgotten when entities advance. > > > > Best Regards > > Chris > > > > > >