Namespace | Phalcon\Storage\Adapter | Uses | DateInterval, DateTime, Exception, Phalcon\Storage\Serializer\SerializerInterface, Phalcon\Storage\SerializerFactory, Phalcon\Support\Exception | Implements | AdapterInterface |
Class AbstractAdapter
@package Phalcon\Storage\Adapter
@property mixed $adapter @property string $defaultSerializer @property int $lifetime @property array $options @property string $prefix @property SerializerInterface $serializer @property SerializerFactory $serializerFactory
/**
* @var mixed
*/
protected adapter;
/**
* Name of the default serializer class
*
* @var string
*/
protected defaultSerializer = php;
/**
* Name of the default TTL (time to live)
*
* @var int
*/
protected lifetime = 3600;
/**
* @var array
*/
protected options;
/**
* @var string
*/
protected prefix = ph-memo-;
/**
* Serializer
*
* @var SerializerInterface|null
*/
protected serializer;
/**
* Serializer Factory
*
* @var SerializerFactory
*/
protected serializerFactory;
protected function __construct( SerializerFactory $factory, array $options = [] );
AbstractAdapter constructor.
abstract public function clear(): bool;
Flushes/clears the cache
abstract public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
abstract public function delete( string $key ): bool;
Deletes data from the adapter
abstract public function get( string $key, mixed $defaultValue = null ): mixed;
Reads data from the adapter
public function getAdapter(): mixed;
Returns the adapter - connects to the storage if not connected
public function getDefaultSerializer(): string
abstract public function getKeys( string $prefix = string ): array;
Returns all the keys stored
public function getPrefix(): string;
Returns the prefix
abstract public function has( string $key ): bool;
Checks if an element exists in the cache
abstract public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
abstract public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter
public function setDefaultSerializer( string $serializer ): void;
protected function getArrVal( array $collection, mixed $index, mixed $defaultValue = null, string $cast = null ): mixed;
@todo Remove this when we get traits
protected function getFilteredKeys( mixed $keys, string $prefix ): array;
Filters the keys array based on global and passed prefix
protected function getPrefixedKey( mixed $key ): string;
Returns the key requested, prefixed
protected function getSerializedData( mixed $content ): mixed;
Returns serialized data
protected function getTtl( mixed $ttl ): int;
Calculates the TTL for a cache item
protected function getUnserializedData( mixed $content, mixed $defaultValue = null ): mixed;
Returns unserialized data
protected function initSerializer(): void;
Initializes the serializer
@throws SupportException
Namespace | Phalcon\Storage\Adapter | Uses | Phalcon\Storage\Serializer\SerializerInterface |
Interface for Phalcon\Logger adapters
public function clear(): bool;
Flushes/clears the cache
public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
public function delete( string $key ): bool;
Deletes data from the adapter
public function get( string $key, mixed $defaultValue = null ): mixed;
Reads data from the adapter
public function getAdapter(): mixed;
Returns the already connected adapter or connects to the backend server(s)
public function getKeys( string $prefix = string ): array;
Returns all the keys stored
public function getPrefix(): string;
Returns the prefix for the keys
public function has( string $key ): bool;
Checks if an element exists in the cache
public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter. If the TTL is null
(default) or not defined then the default TTL will be used, as set in this adapter. If the TTL is 0
or a negative number, a delete()
will be issued, since this item has expired. If you need to set this key forever, you should use the setForever()
method.
public function setForever( string $key, mixed $value ): bool;
Stores data in the adapter forever. The key needs to manually deleted from the adapter.
Namespace | Phalcon\Storage\Adapter | Uses | APCuIterator, DateInterval, Exception, Phalcon\Storage\SerializerFactory, Phalcon\Support\Exception | Extends | AbstractAdapter |
Apcu adapter
@property array $options
/**
* @var string
*/
protected prefix = ph-apcu-;
public function __construct( SerializerFactory $factory, array $options = [] );
Apcu constructor.
public function clear(): bool;
Flushes/clears the cache
public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
public function delete( string $key ): bool;
Reads data from the adapter
public function get( string $key, mixed $defaultValue = null ): mixed;
Reads data from the adapter
public function getKeys( string $prefix = string ): array;
Stores data in the adapter
public function has( string $key ): bool;
Checks if an element exists in the cache
public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter
public function setForever( string $key, mixed $value ): bool;
Stores data in the adapter forever. The key needs to manually deleted from the adapter.
Namespace | Phalcon\Storage\Adapter | Uses | DateInterval, Exception, Phalcon\Storage\Exception, Phalcon\Storage\SerializerFactory, Phalcon\Support\Exception | Extends | AbstractAdapter |
Libmemcached adapter
/**
* @var string
*/
protected prefix = ph-memc-;
public function __construct( SerializerFactory $factory, array $options = [] );
Libmemcached constructor.
public function clear(): bool;
Flushes/clears the cache
public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
public function delete( string $key ): bool;
Reads data from the adapter
public function get( string $key, mixed $defaultValue = null ): mixed;
Reads data from the adapter
public function getAdapter(): mixed;
Returns the already connected adapter or connects to the Memcached server(s)
public function getKeys( string $prefix = string ): array;
Stores data in the adapter
public function has( string $key ): bool;
Checks if an element exists in the cache
public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter
public function setForever( string $key, mixed $value ): bool;
Stores data in the adapter forever. The key needs to manually deleted from the adapter.
Namespace | Phalcon\Storage\Adapter | Uses | DateInterval, Exception, Phalcon\Storage\SerializerFactory, Phalcon\Support\Exception | Extends | AbstractAdapter |
Memory adapter
@property array $data @property array $options
/**
* @var array
*/
protected data;
public function __construct( SerializerFactory $factory, array $options = [] );
Memory constructor.
public function clear(): bool;
Flushes/clears the cache
public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
public function delete( string $key ): bool;
Deletes data from the adapter
public function get( string $key, mixed $defaultValue = null );
Reads data from the adapter
public function getKeys( string $prefix = string ): array;
Stores data in the adapter
public function has( string $key ): bool;
Checks if an element exists in the cache
public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter
public function setForever( string $key, mixed $value ): bool;
Stores data in the adapter forever. The key needs to manually deleted from the adapter.
Namespace | Phalcon\Storage\Adapter | Uses | DateInterval, Exception, Phalcon\Storage\Exception, Phalcon\Storage\SerializerFactory, Phalcon\Support\Exception | Extends | AbstractAdapter |
Redis adapter
@property array $options
/**
* @var string
*/
protected prefix = ph-reds-;
public function __construct( SerializerFactory $factory, array $options = [] );
Redis constructor.
public function clear(): bool;
Flushes/clears the cache
public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
public function delete( string $key ): bool;
Reads data from the adapter
public function get( string $key, mixed $defaultValue = null ): mixed;
Reads data from the adapter
public function getAdapter(): mixed;
Returns the already connected adapter or connects to the Redis server(s)
public function getKeys( string $prefix = string ): array;
Stores data in the adapter
public function has( string $key ): bool;
Checks if an element exists in the cache
public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter
public function setForever( string $key, mixed $value ): bool;
Stores data in the adapter forever. The key needs to manually deleted from the adapter.
Namespace | Phalcon\Storage\Adapter | Uses | DateInterval, FilesystemIterator, Iterator, Phalcon\Storage\Exception, Phalcon\Storage\SerializerFactory, Phalcon\Storage\Traits\StorageErrorHandlerTrait, Phalcon\Support\Exception, Phalcon\Traits\Helper\Str\DirFromFileTrait, Phalcon\Traits\Helper\Str\DirSeparatorTrait, Phalcon\Traits\Php\FileTrait, RecursiveDirectoryIterator, RecursiveIteratorIterator | Extends | AbstractAdapter |
Stream adapter
@property string $storageDir @property array $options
/**
* @var string
*/
protected prefix = ph-strm;
/**
* @var string
*/
protected storageDir = ;
public function __construct( SerializerFactory $factory, array $options = [] );
Stream constructor.
public function clear(): bool;
Flushes/clears the cache
public function decrement( string $key, int $value = int ): int | bool;
Decrements a stored number
public function delete( string $key ): bool;
Reads data from the adapter
public function get( string $key, mixed $defaultValue = null ): mixed;
Reads data from the adapter
public function getKeys( string $prefix = string ): array;
Stores data in the adapter
public function has( string $key ): bool;
Checks if an element exists in the cache and is not expired
public function increment( string $key, int $value = int ): int | bool;
Increments a stored number
public function set( string $key, mixed $value, mixed $ttl = null ): bool;
Stores data in the adapter
public function setForever( string $key, mixed $value ): bool;
Stores data in the adapter forever. The key needs to manually deleted from the adapter.
Namespace | Phalcon\Storage | Uses | Phalcon\Factory\AbstractFactory, Phalcon\Storage\Adapter\AdapterInterface | Extends | AbstractFactory |
This file is part of the Phalcon Framework.
(c) Phalcon Team [email protected]
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
/**
* @var SerializerFactory
*/
private serializerFactory;
public function __construct( SerializerFactory $factory, array $services = [] );
AdapterFactory constructor.
public function newInstance( string $name, array $options = [] ): AdapterInterface;
Create a new instance of the adapter
protected function getExceptionClass(): string;
protected function getServices(): array;
Returns the available adapters
Namespace | Phalcon\Storage | Extends | \Exception |
Phalcon\Storage\Exception
Exceptions thrown in Phalcon\Storage will use this class
Namespace | Phalcon\Storage\Serializer | Implements | SerializerInterface |
Class AbstractSerializer
@package Phalcon\Storage\Serializer
@property mixed $data
/**
* @var mixed
*/
protected data;
public function __construct( mixed $data = null );
Constructor.
public function getData(): mixed;
public function setData( mixed $data ): void;
protected function isSerializable( mixed $data ): bool;
If this returns true, then the data returns back as is
Namespace | Phalcon\Storage\Serializer | Uses | InvalidArgumentException | Extends | AbstractSerializer |
Class Base64
@package Phalcon\Storage\Serializer
public function serialize(): string;
Serializes data
public function unserialize( mixed $data ): void;
Unserializes data
Namespace | Phalcon\Storage\Serializer | Extends | AbstractSerializer |
This file is part of the Phalcon Framework.
(c) Phalcon Team [email protected]
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
public function serialize();
Serializes data
public function unserialize( mixed $data ): void;
Unserializes data
Namespace | Phalcon\Storage\Serializer | Uses | InvalidArgumentException, JsonSerializable | Extends | AbstractSerializer |
Class Json
@package Phalcon\Storage\Serializer
public function serialize();
Serializes data
public function unserialize( mixed $data ): void;
Unserializes data
Namespace | Phalcon\Storage\Serializer | Extends | AbstractSerializer |
This file is part of the Phalcon Framework.
(c) Phalcon Team [email protected]
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
public function serialize(): string | null;
Serializes data
public function unserialize( mixed $data ): void;
Unserializes data
Namespace | Phalcon\Storage\Serializer | Extends | AbstractSerializer |
Class None
@package Phalcon\Storage\Serializer
public function serialize(): string;
Serializes data
public function unserialize( mixed $data ): void;
Unserializes data
Namespace | Phalcon\Storage\Serializer | Uses | InvalidArgumentException, Phalcon\Storage\Traits\StorageErrorHandlerTrait | Extends | AbstractSerializer |
This file is part of the Phalcon Framework.
(c) Phalcon Team [email protected]
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
public function serialize(): string;
Serializes data
public function unserialize( mixed $data ): void;
Unserializes data
Namespace | Phalcon\Storage\Serializer | Uses | Serializable | Extends | Serializable |
Interface SerializerInterface
@package Phalcon\Storage\Serializer
public function getData(): mixed;
public function setData( mixed $data ): void;
Namespace | Phalcon\Storage | Uses | Phalcon\Factory\AbstractFactory, Phalcon\Storage\Serializer\SerializerInterface | Extends | AbstractFactory |
This file is part of the Phalcon Framework.
(c) Phalcon Team [email protected]
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
public function __construct( array $services = [] );
SerializerFactory constructor.
public function newInstance( string $name ): SerializerInterface;
protected function getExceptionClass(): string;
protected function getServices(): array;
Returns the available adapters