Cache
Cache Class.
Namespace: WebberZone\Better_Search\Util
Since: 3.3.0
Source: includes/util/class-cache.php line 23
Methods
__construct()
Constructor class.
Since: 3.3.0
Line: 30
public function __construct( );
invalidate_empty_results() static
Invalidate empty result sets after posts change.
Since: 4.5.0
Line: 39
static public function invalidate_empty_results( ): void;
Returns: void
ajax_clearcache()
Function to clear the Better Search Cache with Ajax.
Since: 3.3.0
Line: 48
public function ajax_clearcache( );
delete() static
Delete the Better Search cache.
Since: 3.3.0
Line: 74
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.
delete_all() static
Delete every Better Search cache entry, in both the blog and the network scope.
Search results are cached as blog transients by the ordinary query path and as site transients by the custom-table path, so clearing only one scope leaves the other serving results built from superseded settings.
Since: 4.5.0
Line: 106
static public function delete_all( ): int;
Returns: int — Number of transients deleted.
get_keys() static
Get the default meta keys used for the cache
Since: 3.3.0
Line: 119
static public function get_keys( $network = ... ): array;
| Type | Name | Description |
|---|---|---|
bool |
$network |
Look up network (site) transients instead of blog transients. |
Returns: array — Transient meta keys
get_key() static
Get the cache key based on a list of parameters.
Since: 3.3.0
Line: 170
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: 265
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: 281
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.