Cache\Backend\Memcache

extends abstract class Phalcon\Cache\Backend implements Phalcon\Cache\BackendInterface Source on GitHub Allows to cache output fragments, PHP data or raw data to a memcache backend This adapter uses the special memcached key “_PHCM” to store all the keys internally used by the adapter use Phalcon\Cache\Backend\Memcache; use Phalcon\Cache\Frontend\Data as FrontData; // Cache data for 2 days $frontCache = new FrontData([ 'lifetime' => 172800 ]); // Create the Cache setting memcache

Cache\Backend\Libmemcached::_connect

public _connect () Create internal connection to memcached

Cache\Backend\Libmemcached::save

public save ([int | string $keyName], [string $content], [long $lifetime], [boolean $stopBuffer]) Stores cached content into the file backend and stops the frontend

Cache\Backend\Libmemcached::queryKeys

public array queryKeys ([string $prefix]) Query the existing cached keys

Cache\Backend\Libmemcached::increment

public long increment ([string $keyName], [mixed $value]) Increment of given $keyName by $value

Cache\Backend\Libmemcached::get

public get (mixed $keyName, [mixed $lifetime]) Returns a cached content

Cache\Backend\Libmemcached::flush

public flush () Immediately invalidates all existing items. Memcached does not support flush() per default. If you require flush() support, set $config[“statsKey”]. All modified keys are stored in “statsKey”. Note: statsKey has a negative performance impact. $cache = new \Phalcon\Cache\Backend\Libmemcached($frontCache, ["statsKey" => "_PHCM"]); $cache->save('my-data', array(1, 2, 3, 4, 5)); //'my-data' and all other used keys are deleted $cache->flush();

Cache\Backend\Libmemcached::exists

public boolean exists ([string $keyName], [long $lifetime]) Checks if cache exists and it isn’t expired

Cache\Backend\Libmemcached::delete

public boolean delete (int | string $keyName) Deletes a value from the cache by its key

Cache\Backend\Libmemcached::decrement

public long decrement ([string $keyName], [long $value]) Decrement of $keyName by given $value