Methods

Allows for default getting and setting

__call($method, $args) : void | mixed

Parameters

$method

string

$args

array

Returns

voidmixed

Default constructor, any extension should either load this first or act similar

__construct(string $identifier, array $config) 

Parameters

$identifier

string

the identifier for this cache

$config

array

additional config values

Does get() & set() in one call that takes a callback and it's arguments to generate the contents

call(string | array $callback, array $args, int | null $expiration, array $dependencies) : mixed

Parameters

$callback

stringarray

Valid PHP callback

$args

array

Arguments for the above function/method

$expiration

intnull

Cache expiration in seconds

$dependencies

array

Contains the identifiers of caches this one will depend on

Returns

mixed

Should check all dependencies against the creation timestamp.

check_dependencies(array $dependencies) : bool

This is static to make it possible in the future to check dependencies from other storages then the current one, though I don't have a clue yet how to make that possible.

Parameters

$dependencies

array

Returns

booleither true or false on any failure

Should delete this cache instance, should also run reset() afterwards

delete() 

Flushes the whole cache for a specific storage type or just a part of it when $section is set (might not work with all storage drivers), defaults to the default storage type

delete_all($section) 

Parameters

$section

string

Front for reading the cache, ensures interchangeability of storage engines.

get(bool $use_expiration) : \Fuel\Core\Cache_Storage_Driver

Actual reading is being done by the _get() method which needs to be extended.

Parameters

$use_expiration

bool

Exceptions

\CacheExpiredException
\CacheNotFoundException

Returns

Gets a specific content handler

get_content_handler($handler) : \Fuel\Core\Cache_Handler_Driver

Parameters

$handler

string

Returns

Fetches contents

get_contents() : mixed

Returns

mixed

Resets all properties except for the identifier, should be run by default when a delete() is triggered

reset() 

Front for writing the cache, ensures interchangeability of storage engines.

set(mixed $contents, bool $expiration, array $dependencies) 

Actual writing is being done by the _set() method which needs to be extended.

Parameters

$contents

mixed

The content to be cached

$expiration

bool

The time in seconds until the cache will expire, =< 0 or null means no expiration

$dependencies

array

array of names on which this cache depends for

Set the contents with optional handler instead of the default

set_contents($contents, $handler) : \Fuel\Core\Cache_Storage_Driver

Parameters

$contents

mixed

$handler

string

Returns

Converts the identifier to a string when necessary: A int is just converted to a string, all others are serialized and then md5'd

stringify_identifier(mixed $identifier) : string

Parameters

$identifier

mixed

Exceptions

\FuelException

Returns

string

Abstract method that should take care of the storage engine specific reading.

_get() : bool

Needs to set the object properties: - created - expiration - dependencies - contents - content_handler

Returns

boolsuccess of the operation

Abstract method that should take care of the storage engine specific writing.

_set() 

Needs to write the object properties: - created - expiration - dependencies - contents - content_handler

Converts the cachable format to the original value

handle_reading($contents) : mixed

Parameters

$contents

Returns

mixed

Converts the contents the cachable format

handle_writing($contents) : string

Parameters

$contents

Returns

string

Decides a content handler that makes it possible to write non-strings to a file

set_content_handler($handler) : \Fuel\Core\Cache_Storage_Driver

Parameters

$handler

string

Returns

 Properties

 

<p>defines which class properties are gettable with get_... in the __call() method</p>

$_gettable : array

 

<p>defines which class properties are settable with set_... in the __call() method</p>

$_settable : array

 

<p>name of the content handler driver</p>

$content_handler : string

 

<p>the contents of this</p>

$contents : mixed

 

<p>timestamp of creation of the cache</p>

$created : int

 

<p>contains identifiers of other caches this one depends on</p>

$dependencies : array

 

<p>loaded driver</p>

$driver : string

 

<p>timestamp when this cache will expire</p>

$expiration : int

 

<p>handles and formats the cache's contents</p>

$handler_object : \Fuel\Core\Cache_Handler_Driver

 

<p>the cache's name, either string or md5'd serialization of something else</p>

$identifier : string