Cache
Cache Class.
Namespace: WebberZone\Knowledge_Base\Util
Since: 2.3.0
Source: includes/util/class-cache.php line 23
Methods
__construct()
Constructor class.
Since: 2.3.0
Line: 30
public function __construct( );
ajax_clearcache()
Function to clear the Knowledge Base Cache with Ajax.
Since: 2.3.0
Line: 39
public function ajax_clearcache( );
delete() static
Delete the Knowledge Base cache.
Since: 2.3.0
Line: 66
static public function delete( $meta_keys = ... ): int;
| Type | Name | Description |
|---|---|---|
array | $meta_keys | Array of meta keys to delete. |
Returns: int — Number of meta keys deleted.
get_keys() static
Get the default meta keys used for the cache
Line: 99
static public function get_keys( ): array;
Returns: array — Transient meta keys
get_key() static
Get the meta key based on a list of parameters.
Line: 130
static public function get_key( $attr ): string;
| Type | Name | Description |
|---|---|---|
mixed | $attr | Array of attributes typically. |
Returns: string — Cache meta key
get_timestamp_key() static
Get the timestamp meta key for a cache entry.
Since: 3.0.0
Line: 145
static public function get_timestamp_key( $cache_key ): string;
| Type | Name | Description |
|---|---|---|
string | $cache_key | The cache key. |
Returns: string — Timestamp meta key
is_expired() static
Check if a cache entry has expired.
Since: 3.0.0
Line: 158
static public function is_expired( $term_id, $cache_key ): bool;
| Type | Name | Description |
|---|---|---|
int | $term_id | Term ID. |
string | $cache_key | Cache key. |
Returns: bool — True if expired or no expiry set, false if still valid.
set() static
Store cache data with timestamp.
Since: 3.0.0
Line: 191
static public function set( $term_id, $cache_key, $data ): bool;
| Type | Name | Description |
|---|---|---|
int | $term_id | Term ID. |
string | $cache_key | Cache key. |
mixed | $data | Data to cache. |
Returns: bool — True on success, false on failure.
get() static
Get cache data if not expired.
Since: 3.0.0
Line: 226
static public function get( $term_id, $cache_key ): mixed|false;
| Type | Name | Description |
|---|---|---|
int | $term_id | Term ID. |
string | $cache_key | Cache key. |
Returns: mixed|false — Cached data if valid, false if expired or not found.
delete_expired_entry() static
Delete an expired cache entry and its timestamp.
Since: 3.0.0
Line: 246
static public function delete_expired_entry( $term_id, $cache_key ): bool;
| Type | Name | Description |
|---|---|---|
int | $term_id | Term ID. |
string | $cache_key | Cache key. |
Returns: bool — True on success, false on failure.