简体   繁体   中英

Phalcon: backCache does not work

I try to cache data, but script always do request to DB

public static function getByCitiesIDs(array $ids): array
{
    $di = Di::getDefault();

    /** @var Backend $cache */
    $cache = $di->get('backCache');

    $key = 'get_flights_by_cities:' . md5(json_encode($ids));

    $result = $cache->get($key);

    if ($result === null) {
        $result = RequestToDB();

        $cache->save($key, $result, 36000);
    }
    return $result;
}

What do I do wrong?

Phalcon is unable to write to directory. Check your system write permissions. Give Server (Apache or else) permission to write to directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM