Im building a music social web. For a particular view (where the user sees a world map, which shows de procedence of the plays his songs had) i have a long and heavy php code, which retrieves a lot of info from the database and counts rows,etc.
How am i supposed to cache the result of this php code and only allow to execute it once an hour? The idea is to "update" this section once an hour, and during that period, the user must only see the cached version of the map.
Take a look at the Pattern feature of Zend\Cache
, this is exactly the thing it was designed to handle. Judging by what you've provided I think the ObjectCache or OutputCache might be your best options
start
and end
calls on the cache object. There's also this blog post from 2013 that looks like it might be helpful to you: http://blog.debug.cz/2013/11/cache-patterns-in-php.html