yf_cache_driver_tmp class

Fileplugins/cache/classes/cache/yf_cache_driver_tmp.class.php
Use_class('cache_driver_tmp', 'classes/cache/')
Extendsyf_cache_driver

Public properties

A site sets them in its config with $PROJECT_CONF['cache_driver_tmp']['NAME'] = ...;

PropertyDefaultDescription
$storage []

Inherited properties

from yf_cache_driver: $_parent, $implemented

Public methods 9

del

public function del($name)
    public function del($name)
    {
        unset($this->storage[$name]);
        return true;
    }

flush

public function flush()
    public function flush()
    {
        $this->storage = [];
        return true;
    }

get

public function get($name, $ttl = 0, $params = [])
    public function get($name, $ttl = 0, $params = [])
    {
        if (isset($this->storage[$name])) {
            $this->_hits++;
        } else {
            $this->_misses++;
        }
        return $this->storage[$name] ?? null;
    }

is_ready

public function is_ready()
    public function is_ready()
    {
        return true;
    }

list_keys

public function list_keys()
    public function list_keys()
    {
        return array_keys($this->storage);
    }

set

public function set($name, $data, $ttl = 0)
    public function set($name, $data, $ttl = 0)
    {
        $this->storage[$name] = $data;
        return true;
    }

stats

public function stats()
    public function stats()
    {
        return [
            'hits' => $this->_hits,
            'misses' => $this->_misses,
            'uptime' => null,
            'mem_usage' => memory_get_usage(),
            'mem_avail' => null,
        ];
    }

Methods starting with _ hooks and helpers; not routable as page actions

__call

public function __call($name, $args)

Catch missing method call.

    public function __call($name, $args)
    {
        trigger_error(__CLASS__ . ': No method ' . $name, E_USER_WARNING);
        return false;
    }

__clone

public function __clone()
    public function __clone()
    {
        $this->storage = [];
    }