If you always use the same method (function, class) to read and write the database,
you can always put a cache expiration after each action
eg:
function add() // update, delete { if (added) $this->expire_cache(); } function search() { if (results) $this->set_cache(results); } function expire_cache() {
However, the purpose of caching is to serve the request without the need for an expensive resource, such as a database request,
but if you need to update very often, the cache implementation is not so useful
Memcache example: http://php.net/manual/en/book.memcache.php
you will need to compile the memcache module, configure and start the memcache server to use memcache
source share