CacheWrapper
in package
Wrapper for CacheInterface that store Repository items.
Compatible with react/cache 0.5 - 1.x and psr/simple-cache interface.
Tags
Table of Contents
Properties
- $config : CacheConfig
- $class : string
- The item class name reference.
- $config : CacheConfig
- Cache configuration.
- $discord : Discord
- $interface : CacheInterface|CacheInterface
- $items : mixed
- Repository items array reference.
- $prefix : string
- Cache key prefix.
Methods
- __destruct() : mixed
- __get() : mixed
- clear() : PromiseInterface<string|int, bool>
- Clear all Parts from cache.
- delete() : PromiseInterface<string|int, bool>|bool
- Delete Part from cache.
- deleteMultiple() : PromiseInterface<string|int, bool>
- Delete multiple Parts from cache.
- get() : PromiseInterface<string|int, Part>
- Get Part from cache.
- getMultiple() : PromiseInterface<string|int, array<string|int, mixed>>
- Get multiple Parts from cache.
- getPrefix() : string
- Get the cache key prefix.
- has() : PromiseInterface<string|int, bool>
- Check if Part is present in cache.
- serializer() : object|string
- set() : PromiseInterface<string|int, bool>
- Set Part into cache.
- setMultiple() : PromiseInterface<string|int, bool>
- Set multiple Parts into cache.
- sweep() : int
- Prune deleted items from cache and weaken items. Items with Bot's ID are exempt.
- unserializer() : Part|null
- isZlibCompressed() : bool
- Checks if a value is zlib compressed by checking the magic bytes.
Properties
$config read-only
public
CacheConfig
$config
Cache configuration.
$class
The item class name reference.
protected
string
$class
$config
Cache configuration.
protected
CacheConfig
$config
$discord
protected
Discord
$discord
$interface
protected
CacheInterface|CacheInterface
$interface
$items
Repository items array reference.
protected
mixed
$items
Tags
$prefix
Cache key prefix.
protected
string
$prefix
Methods
__destruct()
public
__destruct() : mixed
__get()
public
__get(string $name) : mixed
Parameters
- $name : string
clear()
Clear all Parts from cache.
public
clear() : PromiseInterface<string|int, bool>
For react/cache 0.5 polyfill.
Return values
PromiseInterface<string|int, bool>delete()
Delete Part from cache.
public
delete(string $key) : PromiseInterface<string|int, bool>|bool
Parameters
- $key : string
Return values
PromiseInterface<string|int, bool>|booldeleteMultiple()
Delete multiple Parts from cache.
public
deleteMultiple(array<string|int, mixed> $keys) : PromiseInterface<string|int, bool>
For react/cache 0.5 polyfill.
Parameters
- $keys : array<string|int, mixed>
Return values
PromiseInterface<string|int, bool>get()
Get Part from cache.
public
get(string $key[, mixed $default = null ]) : PromiseInterface<string|int, Part>
Parameters
- $key : string
- $default : mixed = null
Return values
PromiseInterface<string|int, Part>getMultiple()
Get multiple Parts from cache.
public
getMultiple(array<string|int, mixed> $keys[, Part|null $default = null ]) : PromiseInterface<string|int, array<string|int, mixed>>
For react/cache 0.5 polyfill.
Parameters
- $keys : array<string|int, mixed>
- $default : Part|null = null
Return values
PromiseInterface<string|int, array<string|int, mixed>>getPrefix()
Get the cache key prefix.
public
getPrefix() : string
Return values
stringhas()
Check if Part is present in cache.
public
has(string $key) : PromiseInterface<string|int, bool>
For react/cache 0.5 polyfill.
Parameters
- $key : string
Return values
PromiseInterface<string|int, bool>serializer()
public
serializer(Part $part) : object|string
Parameters
- $part : Part
Return values
object|stringset()
Set Part into cache.
public
set(string $key, Part $value[, mixed $ttl = null ]) : PromiseInterface<string|int, bool>
Parameters
- $key : string
- $value : Part
- $ttl : mixed = null
Return values
PromiseInterface<string|int, bool>setMultiple()
Set multiple Parts into cache.
public
setMultiple(array<string|int, Part> $values[, int|null $ttl = null ]) : PromiseInterface<string|int, bool>
For react/cache 0.5 polyfill.
Parameters
- $values : array<string|int, Part>
- $ttl : int|null = null
Return values
PromiseInterface<string|int, bool>sweep()
Prune deleted items from cache and weaken items. Items with Bot's ID are exempt.
public
sweep() : int
Return values
int —Pruned items.
unserializer()
public
unserializer(string $value) : Part|null
Parameters
- $value : string
Return values
Part|nullisZlibCompressed()
Checks if a value is zlib compressed by checking the magic bytes.
protected
isZlibCompressed(string $data) : bool
Parameters
- $data : string
-
The data to check.
Tags
Return values
bool —whether it's zlib compressed data or not.