Hi,
During my first hours of Phalcon dev I've noticed that
$res = $categories->query()
->columns('id, name, type, deleted, frequency')
->where('user_id = :id:')
->bind(['id' => 34])
->orderBy('name')
->cache(["key" => "my-find-key3"])
->execute();
result doesn't refresh when I modify this query. My modelsCache is
$di->setShared('modelsCache', function () use ($config) {
// Cache data for one day by default
$frontCache = new FrontendData(
array(
"lifetime" => 10
)
);
// Memcached connection settings
$cache = new BackFile(
$frontCache,
array(
"cacheDir" => $config->application->cacheDir
)
);
return $cache;
});
so it should refresh after 10 seconds according to this: https://docs.phalcon.io/pl/latest/reference/cache.html#lifetime
By default, all the created caches use the lifetime set in the frontend creation.
So I did some digging and found this (https://docs.phalcon.io/en/latest/reference/models-cache.html):
// Just cache the resultset. The cache will expire in 1 hour (3600 seconds)
$products = Products::find(
array(
"cache" => array(
"key" => "my-cache"
)
)
);
So my question is: have I come across bug? or did I missed something?
P.S. This solves the problem but question remains.
$res = $categories->query()
->columns('id, name, type, deleted, frequency')
->where('user_id = :id:')
->bind(['id' => 34])
->orderBy('name')
->cache(["lifetime"=> 10, "key" => "my-find-key3"])
->execute();
K.