I’m currently developing a website which will have heavy load, and a certain amount of data.
Over 40000 articles, 300,000 comments, 3,000,000 votes.
Some data need to be real time, like article’votes, article’s comments while other may be delayed, like weekly top article (based on votes), or latest articles on the homepage.
I’m using Doctrine 2, and it is possible to set up a cache driver, however basic configuration will apply to all data, like lifetime.
My question then is first, where do you set up cache ?
I’m using an SOA like application, then I’ve an ArticleController, an ArticleService, and an ArticleRepository.
Second, do I need to set it up manually for each data depending on the realtime constraints and estimated traffic/update frequence?
Thank you.
You can setup you caches in application.ini or Bootstrap.php. I think that application.ini is easier.
In ZF you can choose from few cache frontends (what to store) and backends (how to store) your data. Usually, in one ZF web app you use mixture of them (especially frontends) as they have different properties or purposes. For example, File frontend which can be used to cache config files, is automatically cleared whenever config files are modified. So it is a part of your design process to decide what and how to cache, when to clear caches etc.