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

ORM cache life time?

Hi there, I've set modelsCache,

 $di->set('modelsCache', function() use ($config) {
        $frontCache = new \Phalcon\Cache\Frontend\Data(array(
            "lifetime" => 86400
        ));

        //Memcached connection settings
        $cache = new \Phalcon\Cache\Backend\Memcache($frontCache, array(
            "host" => $config->cache->memcachedServer,
            "port" => $config->cache->memcachedPort
        ));

        return $cache;
    });

In my model search:

$zone = Zones::findFirst(array(
     "zone_hash = ?0",
     "bind" => array(0=>$placement_hash),
     "cache" => array("key"=>CACHE_PREFIX."_ZONES_".$placement_hash)
));

What's the Zone default cache time? 86400?



2.2k

I just write code to test it. It's not 86400! In api

// Just cache the resultset. The cache will expire in 1 hour (3600 seconds)
$products = Products::find(array(
        "cache" => array("key" => "my-cache")
));