Cache
Cache Class.
Namespace: WebberZone\Better_Search\Util
Since: 3.3.0
Source: includes/util/class-cache.php line 21
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 28
public function __construct( );
ajax_clearcache()
Function to clear the Better Search Cache with Ajax.
Since: 3.3.0
Line: 37
public function ajax_clearcache( );
delete() static
Delete the Better Search cache.
Since: 3.3.0
Line: 63
static public function delete( $transients = ..., $network = ... ): int;
| Type | Name | Description |
|---|---|---|
array | $transients | Array of transients to delete. |
bool | $network | Use network (site) transient if true, default false. |
Returns: int — Number of transients deleted.
get_keys() static
Get the default meta keys used for the cache
Since: 3.3.0
Line: 90
static public function get_keys( ): array;
Returns: array — Transient meta keys
get_key() static
Get the cache key based on a list of parameters.
Since: 3.3.0
Line: 121
static public function get_key( $attr, $context = ... ): string;
| Type | Name | Description |
|---|---|---|
mixed | $attr | Array of attributes typically. |
string | $context | Context of the cache key to be set. |
Returns: string — Cache meta key
get() static
Get a cached value by key.
Since: 4.2.0
Line: 216
static public function get( $key, $network = ... ): mixed;
| Type | Name | Description |
|---|---|---|
string | $key | Cache key. |
bool | $network | Use network (site) transient if true, default false. |
Returns: mixed — Cached value or false if not found.
set() static
Set a cached value by key.
Since: 4.2.0
Line: 232
static public function set( $key, $value, $ttl = ..., $network = ... ): bool;
| Type | Name | Description |
|---|---|---|
string | $key | Cache key. |
mixed | $value | Value to cache. |
int | $ttl | Time to live in seconds. |
bool | $network | Use network (site) transient if true, default false. |
Returns: bool — True on success, false on failure.