Skip to content
Martijn Gastkemper edited this page Aug 12, 2020 · 3 revisions

Client-side cache

Enabling static html cache

Memcache

Clear cache

You can always clear your local query cache + static html cache on the commandline:

$ php vendor/bin/g cache clear --e=development (or another environment)

Disabling cache

There are a couple of ways to affect the cache.

Disable reading from the cache:

Zend_Registry::set('readFromCache', false);

Disable reading and writing from/to the cache:

Zend_Registry::get('CacheFrontend')->setOption('caching', false);

To only remove one model's ability to read/write cache, use:

$model->unregisterObserver('Cacheable');

Use one of the first two methods for processes that do a lot of database manipulation. The caching layer would put a strain on the CPU. A better idea is to just forget about caching and clear/write it manually when you're done:

// turn off caching
Zend_Registry::get('CacheFrontend')->setOption('caching', false);

// do long exhaustive process
while (true) { sleep(1); }

// turn on caching
Zend_Registry::get('CacheFrontend')->setOption('caching', true);

// clear cache
Garp_Cache_Manager::purge();

Note that Garp_Cache_Manager respects the caching flag of the frontend. When it is set to false, purge() doesn't act at all. No ClusterClearCache jobs will be created.

Clone this wiki locally