Neuron-PHP

ViewCache
in package

Table of Contents

Properties

$_config  : CacheConfig|null
$_defaultTtl  : int
$_enabled  : bool
$_storage  : ICacheStorage

Methods

__construct()  : mixed
ViewCache constructor
clear()  : bool
Clear all cache
delete()  : bool
Delete cache entry
exists()  : bool
Check if cache key exists
gc()  : int
Run garbage collection to remove expired cache entries
generateKey()  : string
Generate cache key from controller, view and data
get()  : string|null
Get cached content
isEnabled()  : bool
Check if cache is enabled
set()  : bool
Set cached content
setEnabled()  : void
Enable or disable cache
filterSerializableData()  : array<string|int, mixed>
Filter out non-serializable data from array
hashData()  : string
Hash data array for cache key
shouldRunGc()  : bool
Check if garbage collection should run

Properties

Methods

__construct()

ViewCache constructor

public __construct(ICacheStorage $storage[, bool $enabled = true ][, int $defaultTtl = 3600 ][, CacheConfig|null $config = null ]) : mixed
Parameters
$storage : ICacheStorage
$enabled : bool = true
$defaultTtl : int = 3600
$config : CacheConfig|null = null

clear()

Clear all cache

public clear() : bool
Return values
bool

delete()

Delete cache entry

public delete(string $key) : bool
Parameters
$key : string
Return values
bool

exists()

Check if cache key exists

public exists(string $key) : bool
Parameters
$key : string
Return values
bool

gc()

Run garbage collection to remove expired cache entries

public gc() : int
Return values
int

Number of entries removed

generateKey()

Generate cache key from controller, view and data

public generateKey(string $controller, string $view, array<string|int, mixed> $data) : string
Parameters
$controller : string
$view : string
$data : array<string|int, mixed>
Return values
string

get()

Get cached content

public get(string $key) : string|null
Parameters
$key : string
Return values
string|null

isEnabled()

Check if cache is enabled

public isEnabled() : bool
Return values
bool

set()

Set cached content

public set(string $key, string $content[, int|null $ttl = null ]) : bool
Parameters
$key : string
$content : string
$ttl : int|null = null
Tags
throws
CacheException
Return values
bool

setEnabled()

Enable or disable cache

public setEnabled(bool $enabled) : void
Parameters
$enabled : bool

filterSerializableData()

Filter out non-serializable data from array

private filterSerializableData(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
Return values
array<string|int, mixed>

hashData()

Hash data array for cache key

private hashData(array<string|int, mixed> $data) : string
Parameters
$data : array<string|int, mixed>
Return values
string

shouldRunGc()

Check if garbage collection should run

private shouldRunGc() : bool
Return values
bool

        
On this page

Search results