I wrote my own little PHP MVC Framework, and now Im exploring caching strategies in PHP MVC Frameworks. Im thinking about what can be cached, where and how.
The framework I have is simple MVC Framework. I have front controller, that boots up application, registers class auto loading, sets up php run time directives... and at the end analyses URL and dispatches request to appropriate controller, method, action controller, how ever you want to call it. From controller, I have access to Domain Objects, and Data Mappers that can persist Domain Objects to some storage, most of the time Relation Database. From Controllers I have access to Domain Objects and Data Mappers.
So as far as caching goes these are the things I can things I know I can do at the moment. With PHP I can use APC Cache that is opcode cache, but I can also use it to save variables into RAM. Then I can use Memcache and Memcahed that works joust as APC cache but I can access stored cache from different servers If I have to scale. And those two are not opcode caches.
As far as I know I can do these things:
When in controllers, I can save Domain Objects into cache, so I dont have to open connection to database every time, if I already have that Domain Object in cache.
I can build my cache system, that would analyze URLs at bootstrap, and then get already interpreted page for that URL if cache with that page URL exists, if not it would process request and then save that page into cache and associate it with current URL
So, as you can see I dont really know how to implement cache in my MVC, and where should I cache things, how, and what possibilities exists.
So can someone explain this better, or redirect me to some good articles where I could learn about cacheing?
Thanks!