FileAccess Orion

Redis
in package
implements MemoryCache

Define redis cache Define the interface for caching using the redis server

Tags
category

Interface function

author

Tobias Teichner webmaster@teichner.biz

since

File available since v0.1829

Interfaces, Classes, Traits and Enums

MemoryCache
Define memory cache method

Table of Contents

$interface  : Client|null
The interface Local Redis client interface storage
$prefix  : string
The prefix The folder prefix for all stored key root entries
__construct()  : mixed
Redis constructor.
Delete()  : bool|null
Delete cache from storage Remove the values from storage, deletes the ttl entry as well
DeleteByPattern()  : bool
Delete by key Delete the entries by given search key pattern
HasConnection()  : bool
Check if is connected Connects to memcache handler and returns connection status.
Information()  : Result
Get list of information keys Evaluate the search pattern and return the found information keys
Keys()  : array<string|int, mixed>
Get list of keys Evaluate the search pattern and return the found top level keys
Read()  : mixed
Read cache file from storage Get the values from cache file from storage, do deserialize when not raw
Scan()  : array<string|int, mixed>
Search for keys by pattern
Write()  : mixed
Write cache file to storage Set the values of cache file to storage, do serialize when not raw
extractFolder()  : string
Get base folder from path
pathToKey()  : string
Convert path to key

Properties

$interface

The interface Local Redis client interface storage

private Client|null $interface = null

A redis client instance

$prefix

The prefix The folder prefix for all stored key root entries

private string $prefix = ''

A prefix for all keys stored

Methods

__construct()

Redis constructor.

public __construct(string $prefix) : mixed

Connect to redis server and start the interface.

Parameters
$prefix : string

The cache setup prefix

Return values
mixed

Delete()

Delete cache from storage Remove the values from storage, deletes the ttl entry as well

public Delete(string $cache_file) : bool|null
Parameters
$cache_file : string

Relative file path

Return values
bool|null

The delete operation result

DeleteByPattern()

Delete by key Delete the entries by given search key pattern

public DeleteByPattern(string $pattern) : bool
Parameters
$pattern : string

Search pattern

Return values
bool

Connection possible and key deleted

HasConnection()

Check if is connected Connects to memcache handler and returns connection status.

public HasConnection() : bool
Return values
bool

Connection possible

Information()

Get list of information keys Evaluate the search pattern and return the found information keys

public Information(string|null $pattern) : Result
Parameters
$pattern : string|null

Search pattern

Return values
Result

A list of found keys

Keys()

Get list of keys Evaluate the search pattern and return the found top level keys

public Keys(string $pattern) : array<string|int, mixed>
Parameters
$pattern : string

Search pattern

Tags
inheritDoc
Return values
array<string|int, mixed>

A list of found keys

Read()

Read cache file from storage Get the values from cache file from storage, do deserialize when not raw

public Read(string $cache_file[, bool $raw = false ][, bool $honor_ttl = false ]) : mixed
Parameters
$cache_file : string

Relative file path

$raw : bool = false

When set to true, return the value direct without deserialize.

$honor_ttl : bool = false
Return values
mixed

The stored values

Scan()

Search for keys by pattern

public Scan(string $key, string $pattern) : array<string|int, mixed>
Parameters
$key : string

Key to search in

$pattern : string

The pattern to search for

Tags
inheritDoc
Return values
array<string|int, mixed>

The list of found key value pairs

Write()

Write cache file to storage Set the values of cache file to storage, do serialize when not raw

public Write(string $cache_file, mixed $data[, bool $raw = false ][, int $ttl = -1 ]) : mixed
Parameters
$cache_file : string

Relative file path

$data : mixed

The data to store

$raw : bool = false

When set to true, return the value direct without deserialize.

$ttl : int = -1

Optional time to live.

Return values
mixed

The stored values

extractFolder()

Get base folder from path

private static extractFolder(string $cache_file) : string
Parameters
$cache_file : string
Return values
string

pathToKey()

Convert path to key

private static pathToKey(string $cache_file) : string
Parameters
$cache_file : string
Return values
string

Search results