yf_cache_driver_memcache class

Fileplugins/cache/classes/cache/yf_cache_driver_memcache.class.php
Use_class('cache_driver_memcache', 'classes/cache/')
Extendsyf_cache_driver

Public properties

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

PropertyDefaultDescription
$_connection
object
null internal @conf_skip

Inherited properties

from yf_cache_driver: $_parent, $implemented

Public methods 8

del

public function del($name)
    public function del($name)
    {
        if ( ! $this->is_ready()) {
            return null;
        }
        return $this->_connection->del($name) ?: null;
    }

flush

public function flush()
    public function flush()
    {
        if ( ! $this->is_ready()) {
            return null;
        }
        return $this->_connection->flush() ?: null;
    }

get

public function get($name, $ttl = 0, $params = [])
    public function get($name, $ttl = 0, $params = [])
    {
        if ( ! $this->is_ready()) {
            return null;
        }
        return $this->_connection->get($name, $ttl, $params);
    }

is_ready

public function is_ready()
    public function is_ready()
    {
        return $this->_connection && $this->_connection->is_ready();
    }

set

public function set($name, $data, $ttl = 0)
    public function set($name, $data, $ttl = 0)
    {
        if ( ! $this->is_ready()) {
            return null;
        }
        return $this->_connection->set($name, $data, $ttl);
    }

stats

public function stats()
    public function stats()
    {
        if ( ! $this->is_ready()) {
            return null;
        }
        return $this->_connection->stats() ?: 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)
    {
        // Support for driver-specific methods
        if (is_object($this->_connection) && method_exists($this->_connection, $name)) {
            return call_user_func_array([$this->_connection, $name], $args);
        }
        return main()->extend_call($this, $name, $args);
    }

_init

public function _init()
    public function _init()
    {
        $this->_connection = memcached();
        $this->_connection->connect();
    }