cache.php
Table of Contents
Functions
- buddyc_cache_get() : mixed
- Retrieves a cached value from the preferred caching method.
- buddyc_cache_set() : bool
- Stores a value in the cache.
- buddyc_cache_delete() : bool
- Deletes a cached value.
- buddyc_cache_clear_all() : mixed
- Clears all cached values belonging to this plugin (transients, options, and wp_cache).
Functions
buddyc_cache_get()
Retrieves a cached value from the preferred caching method.
buddyc_cache_get(string $key[, string $group = 'default' ][, string $type = 'wp_cache' ]) : mixed
Parameters
- $key : string
-
The cache key.
- $group : string = 'default'
-
Optional. Cache group for wp_cache. Default is 'default'.
- $type : string = 'wp_cache'
-
Optional. Cache type: 'wp_cache', 'transient', or 'option'. Default is 'wp_cache'.
Tags
Return values
mixed —Cached value or false if not found.
buddyc_cache_set()
Stores a value in the cache.
buddyc_cache_set(string $key, mixed $value[, int $expires = HOUR_IN_SECONDS ][, string $group = 'default' ][, string $type = 'wp_cache' ]) : bool
Parameters
- $key : string
-
The cache key.
- $value : mixed
-
The value to store.
- $expires : int = HOUR_IN_SECONDS
-
Expiration time in seconds. Default is 1 hour.
- $group : string = 'default'
-
Optional. Cache group for wp_cache.
- $type : string = 'wp_cache'
-
Optional. Cache type: 'wp_cache', 'transient', or 'option'. Default is 'wp_cache'.
Tags
Return values
bool —True on success, false on failure.
buddyc_cache_delete()
Deletes a cached value.
buddyc_cache_delete(string $key[, string $group = 'default' ][, string $type = 'wp_cache' ]) : bool
Parameters
- $key : string
-
The cache key.
- $group : string = 'default'
-
Optional. Cache group for wp_cache.
- $type : string = 'wp_cache'
-
Optional. Cache type: 'wp_cache', 'transient', or 'option'. Default is 'wp_cache'.
Tags
Return values
bool —True on success, false on failure.
buddyc_cache_clear_all()
Clears all cached values belonging to this plugin (transients, options, and wp_cache).
buddyc_cache_clear_all() : mixed