File
About 1 min
File
- Full name:
\Hazaar\Cache\Backend\File
- Parent class:
\Hazaar\Cache\Backend
Properties
weight
protected int $weight
zlib
private bool $zlib
cacheDir
private string $cacheDir
timeout
private int $timeout
local
private array $local
store
private \Hazaar\File\BTree $store
__openStore
private static \Hazaar\File\BTree[] $__openStore
- This property is static.
Methods
__destruct
Store the namespace timeout in the cache dir timeout file.
public __destruct(): mixed
This should only happen if a keepalive() has been called.
available
public static available(): bool
- This method is static.
init
public init(string $namespace): void
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace | string |
has
Check if a value exists.
public has(string $key, bool $check_empty = false): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$check_empty | bool |
get
public get(string $key): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
set
public set(string $key, mixed $value, ?int $timeout): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$timeout | ?int |
remove
public remove(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
clear
public clear(): bool
toArray
public toArray(): array
count
public count(): int
keepalive
private keepalive(): void
load
Load the key value from storage.
private load(string $key, ?array& $cache = null): mixed
This should only happen once and then it will be stored in memory and only written again when changed.
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$cache | ?array |
Inherited methods
__construct
Backend constructor.
final public __construct(array|\Hazaar\Map $options, string $namespace): mixed
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$options | array|\Hazaar\Map | |
$namespace | string |
__destruct
public __destruct(): mixed
close
public close(): bool
can
public can(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
getWeight
public getWeight(): int
setOption
public setOption(string $key, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed |
lock
public lock(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
unlock
public unlock(string $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string |
addCapabilities
protected addCapabilities(string $args): void
Parameters:
Parameter | Type | Description |
---|---|---|
$args | string |
configure
protected configure(array|\Hazaar\Map $options): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | array|\Hazaar\Map |
Automatically generated on 2024-11-14