Nette\Caching\Storages\SQLiteStorage::read PHP Method

read() public method

Read from cache.
public read ( $key ) : mixed | null
return mixed | null
    public function read($key)
    {
        $stmt = $this->pdo->prepare('SELECT data, slide FROM cache WHERE key=? AND (expire IS NULL OR expire >= ?)');
        $stmt->execute([$key, time()]);
        if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            if ($row['slide'] !== NULL) {
                $this->pdo->prepare('UPDATE cache SET expire = ? + slide WHERE key=?')->execute([time(), $key]);
            }
            return unserialize($row['data']);
        }
    }