yii\caching\DbCache::getValues PHP Method

getValues() protected method

Retrieves multiple values from cache with the specified keys.
protected getValues ( array $keys ) : array
$keys array a list of keys identifying the cached values
return array a list of cached values indexed by the keys
    protected function getValues($keys)
    {
        if (empty($keys)) {
            return [];
        }
        $query = new Query();
        $query->select(['id', 'data'])->from($this->cacheTable)->where(['id' => $keys])->andWhere('([[expire]] = 0 OR [[expire]] > ' . time() . ')');
        if ($this->db->enableQueryCache) {
            $this->db->enableQueryCache = false;
            $rows = $query->createCommand($this->db)->queryAll();
            $this->db->enableQueryCache = true;
        } else {
            $rows = $query->createCommand($this->db)->queryAll();
        }
        $results = [];
        foreach ($keys as $key) {
            $results[$key] = false;
        }
        foreach ($rows as $row) {
            $results[$row['id']] = $row['data'];
        }
        return $results;
    }