Neuron-PHP

CacheStorageFactory
in package

Factory class for creating cache storage instances based on configuration

Table of Contents

Methods

create()  : ICacheStorage
Create a cache storage instance based on configuration
createAutoDetect()  : ICacheStorage
Detect and create the best available cache storage
createFromConfig()  : ICacheStorage
Create storage from CacheConfig object
getAvailableStorageTypes()  : array<string|int, mixed>
Get information about available storage types
isAvailable()  : bool
Check if a specific storage type is available
createFileStorage()  : FileCacheStorage
Create file-based cache storage
createRedisStorage()  : RedisCacheStorage
Create Redis-based cache storage

Methods

create()

Create a cache storage instance based on configuration

public static create(array<string|int, mixed> $Config) : ICacheStorage
Parameters
$Config : array<string|int, mixed>

Cache configuration with keys:

  • storage: Type of storage ('file' or 'redis')
  • path: Path for file storage (required for 'file')
  • redis: Redis configuration array (required for 'redis')
Tags
throws
CacheException
Return values
ICacheStorage

createAutoDetect()

Detect and create the best available cache storage

public static createAutoDetect([array<string|int, mixed> $Config = [] ]) : ICacheStorage
Parameters
$Config : array<string|int, mixed> = []

Optional configuration to merge with defaults

Tags
throws
CacheException
Return values
ICacheStorage

getAvailableStorageTypes()

Get information about available storage types

public static getAvailableStorageTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

isAvailable()

Check if a specific storage type is available

public static isAvailable(string $Type) : bool
Parameters
$Type : string

Storage type ('file' or 'redis')

Return values
bool

        
On this page

Search results