Phalcon cache
NOTE
All classes are prefixed with Phalcon
Cache\AbstractCache¶
Abstract Source on GitHub
This component offers caching capabilities for your application.
Phalcon\Cache\AbstractCache— implementsPhalcon\Cache\CacheInterface,Phalcon\Events\EventsAwareInterface
Uses DateInterval · Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Cache\Adapter\Redis · Phalcon\Cache\Exception\CacheKeysNotIterable · Phalcon\Cache\Exception\InvalidArgumentException · Phalcon\Cache\Exception\InvalidCacheKey · Phalcon\Events\EventsAwareInterface · Phalcon\Events\ManagerInterface · Traversable
Method Summary¶
public __construct( AdapterInterface $adapter ) Constructor. public AdapterInterface getAdapter() Returns the current adapter public ManagerInterface|null getEventsManager() Get the event manager public void setEventsManager( ManagerInterface $eventsManager ) Sets the event manager protected void checkKey( string $key ) Checks the key. If it contains invalid characters an exception is thrown protected void checkKeys( mixed $keys ) Checks the key. If it contains invalid characters an exception is thrown protected bool doClear() Wipes clean the entire cache's keys. protected bool doDelete( string $key ) Delete an item from the cache by its unique key. protected bool doDeleteMultiple( mixed $keys ) Deletes multiple cache items in a single operation. protected mixed doGet(string $key,mixed $defaultValue = null) Fetches a value from the cache. protected array doGetMultiple(mixed $keys,mixed $defaultValue = null) Obtains multiple cache items by their unique keys. protected bool doHas( string $key ) Determines whether an item is present in the cache. protected bool doSet(string $key,mixed $value,mixed $ttl = null) Persists data in the cache, uniquely referenced by a key with an optional protected bool doSetMultiple(mixed $values,mixed $ttl = null) Persists a set of key => value pairs in the cache, with an optional TTL. protected void fire(string $eventName,mixed $keys) Trigger an event for the eventsManager. protected string getExceptionClass() Returns the exception class that will be used for exceptions thrown Properties¶
protected AdapterInterface $adapter The adapter protected ManagerInterface|null $eventsManager = null Event Manager Methods¶
__construct()¶
Constructor.
getAdapter()¶
Returns the current adapter
getEventsManager()¶
Get the event manager
setEventsManager()¶
Sets the event manager
checkKey()¶
Checks the key. If it contains invalid characters an exception is thrown
checkKeys()¶
Checks the key. If it contains invalid characters an exception is thrown
doClear()¶
Wipes clean the entire cache's keys.
doDelete()¶
Delete an item from the cache by its unique key.
doDeleteMultiple()¶
Deletes multiple cache items in a single operation.
doGet()¶
Fetches a value from the cache.
doGetMultiple()¶
Obtains multiple cache items by their unique keys.
doHas()¶
Determines whether an item is present in the cache.
doSet()¶
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
doSetMultiple()¶
Persists a set of key => value pairs in the cache, with an optional TTL.
fire()¶
Trigger an event for the eventsManager.
getExceptionClass()¶
Returns the exception class that will be used for exceptions thrown
Cache\AdapterFactory¶
Class Source on GitHub
Factory to create Cache adapters
Phalcon\Factory\AbstractConfigFactoryPhalcon\Factory\AbstractFactoryPhalcon\Cache\AdapterFactory
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Cache\Exception\Exception · Phalcon\Factory\AbstractFactory · Phalcon\Storage\SerializerFactory
Method Summary¶
public __construct(SerializerFactory $factory,array $services = []) AdapterFactory constructor. public AdapterInterface newInstance(string $name,array $options = []) Create a new instance of the adapter protected string getExceptionClass() protected array getServices() Returns the available adapters Properties¶
protected SerializerFactory $serializerFactory Methods¶
__construct()¶
AdapterFactory constructor.
newInstance()¶
Create a new instance of the adapter
getExceptionClass()¶
getServices()¶
Returns the available adapters
Cache\Adapter\AdapterInterface¶
Interface Source on GitHub
Interface for Phalcon\Cache adapters
Phalcon\Storage\Adapter\AdapterInterfacePhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Storage\Adapter\AdapterInterface
Cache\Adapter\Apcu¶
Class Source on GitHub
Apcu adapter
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\ApcuPhalcon\Cache\Adapter\Apcu— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\Apcu
Properties¶
protected string $eventType = "cache" Cache\Adapter\Libmemcached¶
Class Source on GitHub
Libmemcached adapter
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\LibmemcachedPhalcon\Cache\Adapter\Libmemcached— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\Libmemcached
Properties¶
protected string $eventType = "cache" Cache\Adapter\Memory¶
Class Source on GitHub
Memory adapter
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\MemoryPhalcon\Cache\Adapter\Memory— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\Memory
Properties¶
protected string $eventType = "cache" Cache\Adapter\Redis¶
Class Source on GitHub
Redis adapter
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\RedisPhalcon\Cache\Adapter\Redis— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\Redis
Properties¶
protected string $eventType = "cache" Cache\Adapter\RedisCluster¶
Class Source on GitHub
RedisCluster adapter
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\RedisPhalcon\Storage\Adapter\RedisClusterPhalcon\Cache\Adapter\RedisCluster— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\RedisCluster
Properties¶
protected string $eventType = "cache" Cache\Adapter\Stream¶
Class Source on GitHub
Stream adapter
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\StreamPhalcon\Cache\Adapter\Stream— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\Stream
Properties¶
protected string $eventType = "cache" Cache\Adapter\Weak¶
Class Source on GitHub
WeakCache implementation based on WeakReference
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\WeakPhalcon\Cache\Adapter\Weak— implementsPhalcon\Cache\Adapter\AdapterInterface
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Storage\Adapter\Weak
Properties¶
protected string $eventType = "cache" Cache\Cache¶
Class Source on GitHub
This component offers caching capabilities for your application.
Phalcon\Cache\AbstractCachePhalcon\Cache\Cache
Uses DateInterval · Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Cache\Exception\InvalidArgumentException
Method Summary¶
public bool clear() Wipes clean the entire cache's keys. public bool delete( string $key ) Delete an item from the cache by its unique key. public bool deleteMultiple( mixed $keys ) Deletes multiple cache items in a single operation. public get(string $key,mixed $defaultValue = null) Fetches a value from the cache. public getMultiple(mixed $keys,mixed $defaultValue = null) Obtains multiple cache items by their unique keys. public bool has( string $key ) Determines whether an item is present in the cache. public bool set(string $key,mixed $value,mixed $ttl = null) Persists data in the cache, uniquely referenced by a key with an optional public bool setMultiple(mixed $values,mixed $ttl = null) Persists a set of key => value pairs in the cache, with an optional TTL. protected string getExceptionClass() Returns the exception class that will be used for exceptions thrown Methods¶
clear()¶
Wipes clean the entire cache's keys.
delete()¶
Delete an item from the cache by its unique key.
deleteMultiple()¶
Deletes multiple cache items in a single operation.
get()¶
Fetches a value from the cache.
getMultiple()¶
Obtains multiple cache items by their unique keys.
has()¶
Determines whether an item is present in the cache.
set()¶
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
setMultiple()¶
Persists a set of key => value pairs in the cache, with an optional TTL.
getExceptionClass()¶
Returns the exception class that will be used for exceptions thrown
Cache\CacheFactory¶
Class Source on GitHub
Creates a new Cache class
Phalcon\Factory\AbstractConfigFactoryPhalcon\Cache\CacheFactory
Uses Phalcon\Cache\Adapter\AdapterInterface · Phalcon\Cache\Cache · Phalcon\Cache\Exception\Exception · Phalcon\Config\ConfigInterface · Phalcon\Factory\AbstractConfigFactory
Method Summary¶
public __construct( AdapterFactory $factory ) Constructor public CacheInterface load( mixed $config ) Factory to create an instance from a Config object public CacheInterface newInstance(string $name,array $options = []) Constructs a new Cache instance. protected string getExceptionClass() Properties¶
protected AdapterFactory $adapterFactory Methods¶
__construct()¶
Constructor
load()¶
Factory to create an instance from a Config object
newInstance()¶
Constructs a new Cache instance.
getExceptionClass()¶
Cache\CacheInterface¶
Interface Source on GitHub
Interface for Phalcon\Cache\Cache
Phalcon\Cache\CacheInterface
Uses DateInterval · Phalcon\Cache\Exception\InvalidArgumentException
Method Summary¶
public bool clear() Wipes clean the entire cache's keys. public bool delete( string $key ) Delete an item from the cache by its unique key. public bool deleteMultiple( mixed $keys ) Deletes multiple cache items in a single operation. public get(string $key,mixed $defaultValue = null) Fetches a value from the cache. public getMultiple(mixed $keys,mixed $defaultValue = null) Obtains multiple cache items by their unique keys. public bool has( string $key ) Determines whether an item is present in the cache. public bool set(string $key,mixed $value,mixed $ttl = null) Persists data in the cache, uniquely referenced by a key with an optional public bool setMultiple(mixed $values,mixed $ttl = null) Persists a set of key => value pairs in the cache, with an optional TTL. Methods¶
clear()¶
Wipes clean the entire cache's keys.
delete()¶
Delete an item from the cache by its unique key.
deleteMultiple()¶
Deletes multiple cache items in a single operation.
get()¶
Fetches a value from the cache.
getMultiple()¶
Obtains multiple cache items by their unique keys.
has()¶
Determines whether an item is present in the cache.
set()¶
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
setMultiple()¶
Persists a set of key => value pairs in the cache, with an optional TTL.
Cache\Exception\CacheKeysNotIterable¶
Class Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Cache\Exception\InvalidArgumentExceptionPhalcon\Cache\Exception\CacheKeysNotIterable
Method Summary¶
Methods¶
__construct()¶
Cache\Exception\Exception¶
Class Source on GitHub
Exceptions thrown in Phalcon\Cache will use this class
\ExceptionPhalcon\Cache\Exception\Exception
Cache\Exception\InvalidArgumentException¶
Class Source on GitHub
Exceptions thrown in Phalcon\Cache will use this class
\ExceptionPhalcon\Cache\Exception\InvalidArgumentException
Cache\Exception\InvalidCacheKey¶
Class Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
\ExceptionPhalcon\Cache\Exception\InvalidArgumentExceptionPhalcon\Cache\Exception\InvalidCacheKey