yii\caching\DbCache::getValue PHP Method

getValue() protected method

This is the implementation of the method declared in the parent class.
protected getValue ( string $key ) : string | false
$key string a unique key identifying the cached value
return string | false the value stored in cache, false if the value is not in the cache or expired.
    protected function getValue($key)
    {
        $query = new Query();
        $query->select(['data'])->from($this->cacheTable)->where('[[id]] = :id AND ([[expire]] = 0 OR [[expire]] >' . time() . ')', [':id' => $key]);
        if ($this->db->enableQueryCache) {
            // temporarily disable and re-enable query caching
            $this->db->enableQueryCache = false;
            $result = $query->createCommand($this->db)->queryScalar();
            $this->db->enableQueryCache = true;
            return $result;
        } else {
            return $query->createCommand($this->db)->queryScalar();
        }
    }