We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How turn off all cache for dev env or for high load tests ?

hello, i used modelsMetadata, modelsCache and simple cahce ad servises. ex: $di->set("modelsCache", function() use ($config) { $frontCache = new \Phalcon\Cache\Frontend\Data(array("lifetime" => 180)); return new \Phalcon\Cache\Backend\Libmemcached($frontCache, $config->memcached); });

In all models used cached keys

ex: public static function findFirstByKey( string $key) { return self::findFirst([ "key = ?0", "bind" => [$key], "cache" => ["key" => "findFirstByResourceKey".$key, "lifetime" => 3600], ]); }

a cache can be turned off in one place? ex: $di->set("modelsCache", false) or $di->set("modelsCache" function() { return false; })

 $di->set("modelsCache" function() use $config {
    if($config->env == "dev") return false;
    or load memcache ...

at each location change keys is wrong! any ideas ? I want to check the load without cache

Imho - the best option is to having config files, and there other adapters - for tests and dev enviromen just use memory most likely. For production memcache/redis/apc


cache in 1 s is awkward =) 1s its long time for high load tests . config - how ? if services model cache is not defined, in model cache by key "cache" - will php error .