Cache extends Component

Handles caching.

Table of Contents

__call()  : mixed
Catches calls to undefined methods.
__construct()  : mixed
Class constructor.
clear_comment_cache()  : mixed
Clears comment cache.
clear_meta_cache()  : mixed
Clears meta cache.
clear_post_cache()  : mixed
Clears post cache.
clear_post_term_cache()  : mixed
Clears post term cache.
clear_term_cache()  : mixed
Clears term cache.
clear_transient_cache()  : mixed
Clears transient cache.
clear_user_cache()  : mixed
Clears user cache.
delete_cache()  : mixed
Deletes transient cache.
get_cache()  : mixed
Gets transient cache.
get_cache_version()  : string
Gets transient cache version.
set_cache()  : mixed
Sets transient cache.
boot()  : mixed
Bootstraps component properties.
delete_meta_cache()  : mixed
Deletes meta cache.
get_cache_name()  : string
Gets transient cache name.
get_meta_cache()  : mixed
Gets meta cache.
get_meta_cache_name()  : string
Gets meta cache name.
get_meta_cache_version()  : string
Gets meta cache version.
is_enabled()  : bool
Checks if cache is enabled.
serialize_cache_key()  : string
Serializes cache key.
set_callbacks()  : mixed
Sets the action and filter callbacks.
set_meta_cache()  : mixed
Sets meta cache.
set_property()  : mixed
Sets a property value.
sort_cache_key()  : mixed
Sorts cache key contents.
update_cache_version()  : string
Updates transient cache version.
update_meta_cache_version()  : string
Updates meta cache version.

Methods

__call()

Catches calls to undefined methods.

public __call(string $name, array<string|int, mixed> $args) : mixed
Parameters
$name : string

Method name.

$args : array<string|int, mixed>

Method arguments.

Tags
throws
BadMethodCallException

Invalid method.

Return values
mixed

__construct()

Class constructor.

public __construct([array<string|int, mixed> $args = [] ]) : mixed
Parameters
$args : array<string|int, mixed> = []

Component arguments.

Return values
mixed

clear_comment_cache()

Clears comment cache.

public clear_comment_cache(int $comment_id, string $comment_type) : mixed
Parameters
$comment_id : int

Comment ID.

$comment_type : string

Comment type.

Return values
mixed

clear_post_cache()

Clears post cache.

public clear_post_cache(int $post_id, string $post_type) : mixed
Parameters
$post_id : int

Post ID.

$post_type : string

Post type.

Return values
mixed

clear_post_term_cache()

Clears post term cache.

public clear_post_term_cache(int $post_id, string $post_type, string $taxonomy) : mixed
Parameters
$post_id : int

Post ID.

$post_type : string

Post type.

$taxonomy : string

Taxonomy name.

Return values
mixed

clear_term_cache()

Clears term cache.

public clear_term_cache(int $term_id, string $taxonomy) : mixed
Parameters
$term_id : int

Term ID.

$taxonomy : string

Taxonomy name.

Return values
mixed

clear_user_cache()

Clears user cache.

public clear_user_cache(int $user_id) : mixed
Parameters
$user_id : int

User ID.

Return values
mixed

delete_cache()

Deletes transient cache.

public delete_cache(mixed $key[, string $group = null ]) : mixed
Parameters
$key : mixed

Cache key.

$group : string = null

Cache group.

Return values
mixed

get_cache()

Gets transient cache.

public get_cache(mixed $key[, string $group = null ]) : mixed
Parameters
$key : mixed

Cache key.

$group : string = null

Cache group.

Return values
mixed

get_cache_version()

Gets transient cache version.

public get_cache_version(string $group) : string
Parameters
$group : string

Cache group.

Return values
string

set_cache()

Sets transient cache.

public set_cache(mixed $key, string $group, mixed $value, int $expiration) : mixed
Parameters
$key : mixed

Cache key.

$group : string

Cache group.

$value : mixed

Cache value.

$expiration : int

Expiration period in seconds.

Return values
mixed

delete_meta_cache()

Deletes meta cache.

protected delete_meta_cache(string $type, int $id, mixed $key[, string $group = null ]) : mixed
Parameters
$type : string

Meta type.

$id : int

Object ID.

$key : mixed

Cache key.

$group : string = null

Cache group.

Return values
mixed

get_cache_name()

Gets transient cache name.

protected get_cache_name(mixed $key[, string $group = null ]) : string
Parameters
$key : mixed

Cache key.

$group : string = null

Cache group.

Return values
string

get_meta_cache()

Gets meta cache.

protected get_meta_cache(string $type, int $id, mixed $key[, string $group = null ]) : mixed
Parameters
$type : string

Meta type.

$id : int

Object ID.

$key : mixed

Cache key.

$group : string = null

Cache group.

Return values
mixed

get_meta_cache_name()

Gets meta cache name.

protected get_meta_cache_name(string $type, int $id, mixed $key[, string $group = null ]) : string
Parameters
$type : string

Meta type.

$id : int

Object ID.

$key : mixed

Cache key.

$group : string = null

Cache group.

Return values
string

get_meta_cache_version()

Gets meta cache version.

protected get_meta_cache_version(string $type, int $id, string $group) : string
Parameters
$type : string

Meta type.

$id : int

Object ID.

$group : string

Cache group.

Return values
string

serialize_cache_key()

Serializes cache key.

protected serialize_cache_key(mixed $key) : string
Parameters
$key : mixed

Cache key.

Return values
string

set_callbacks()

Sets the action and filter callbacks.

protected final set_callbacks(array<string|int, mixed> $callbacks) : mixed
Parameters
$callbacks : array<string|int, mixed>

Callback arguments.

Return values
mixed

set_meta_cache()

Sets meta cache.

protected set_meta_cache(string $type, int $id, mixed $key, string $group, mixed $value[, int $expiration = DAY_IN_SECONDS ]) : mixed
Parameters
$type : string

Meta type.

$id : int

Object ID.

$key : mixed

Cache key.

$group : string

Cache group.

$value : mixed

Cache value.

$expiration : int = DAY_IN_SECONDS

Expiration period in seconds.

Return values
mixed

set_property()

Sets a property value.

protected final set_property(string $name, mixed $value[, string $prefix = '' ]) : mixed
Parameters
$name : string

Property name.

$value : mixed

Property value.

$prefix : string = ''

Method prefix.

Return values
mixed

sort_cache_key()

Sorts cache key contents.

protected sort_cache_key(mixed $key) : mixed
Parameters
$key : mixed

Cache key.

Return values
mixed

update_cache_version()

Updates transient cache version.

protected update_cache_version(string $group) : string
Parameters
$group : string

Cache group.

Return values
string

update_meta_cache_version()

Updates meta cache version.

protected update_meta_cache_version(string $type, int $id, string $group) : string
Parameters
$type : string

Meta type.

$id : int

Object ID.

$group : string

Cache group.

Return values
string