[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-includes/backpress/ -> class.wp-object-cache.php (summary)

(no description)

File Size: 305 lines (8 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Object_Cache:: (12 methods):
  add()
  delete()
  flush()
  get()
  replace()
  set()
  stats()
  add_global_groups()
  add_non_persistent_groups()
  WP_Object_Cache()
  __construct()
  __destruct()


Class: WP_Object_Cache  - X-Ref

WordPress Object Cache

The WordPress Object Cache is used to save on trips to the database. The
Object Cache stores all of the cache data to memory and makes the cache
contents available by using a key, which is used to name and later retrieve
the cache contents.

The Object Cache can be replaced by other caching mechanisms by placing files
in the wp-content folder which is looked at in wp-settings. If that file
exists, then this file will not be included.

add($id, $data, $group = 'default', $expire = '')   X-Ref
Adds data to the cache if it doesn't already exist.

return: bool False if cache ID and group already exists, true on success
param: int|string $id What to call the contents in the cache
param: mixed $data The contents to store in the cache
param: string $group Where to group the cache contents
param: int $expire When to expire the cache contents
since: 2.0.0

delete($id, $group = 'default', $force = false)   X-Ref
Remove the contents of the cache ID in the group

If the cache ID does not exist in the group and $force parameter is set
to false, then nothing will happen. The $force parameter is set to false
by default.

On success the group and the id will be added to the
$non_existant_objects property in the class.

return: bool False if the contents weren't deleted and true on success
param: int|string $id What the contents in the cache are called
param: string $group Where the cache contents are grouped
param: bool $force Optional. Whether to force the unsetting of the cache
since: 2.0.0

flush( $group = null )   X-Ref
Clears the object cache of all data

return: bool Always returns true
since: 2.0.0

get($id, $group = 'default')   X-Ref
Retrieves the cache contents, if it exists

The contents will be first attempted to be retrieved by searching by the
ID in the cache group. If the cache is hit (success) then the contents
are returned.

On failure, the $non_existant_objects property is checked and if the
cache group and ID exist in there the cache misses will not be
incremented. If not in the nonexistant objects property, then the cache
misses will be incremented and the cache group and ID will be added to
the nonexistant objects.

return: bool|mixed False on failure to retrieve contents or the cache
param: int|string $id What the contents in the cache are called
param: string $group Where the cache contents are grouped
since: 2.0.0

replace($id, $data, $group = 'default', $expire = '')   X-Ref
Replace the contents in the cache, if contents already exist

return: bool False if not exists, true if contents were replaced
param: int|string $id What to call the contents in the cache
param: mixed $data The contents to store in the cache
param: string $group Where to group the cache contents
param: int $expire When to expire the cache contents
since: 2.0.0

set($id, $data, $group = 'default', $expire = '')   X-Ref
Sets the data contents into the cache

The cache contents is grouped by the $group parameter followed by the
$id. This allows for duplicate ids in unique groups. Therefore, naming of
the group should be used with care and should follow normal function
naming guidelines outside of core WordPress usage.

The $expire parameter is not used, because the cache will automatically
expire for each time a page is accessed and PHP finishes. The method is
more for cache plugins which use files.

return: bool Always returns true
param: int|string $id What to call the contents in the cache
param: mixed $data The contents to store in the cache
param: string $group Where to group the cache contents
param: int $expire Not Used
since: 2.0.0

stats()   X-Ref
Echos the stats of the caching.

Gives the cache hits, and cache misses. Also prints every cached group,
key and the data.

since: 2.0.0

add_global_groups( $groups )   X-Ref
No description

add_non_persistent_groups( $groups )   X-Ref
No description

WP_Object_Cache()   X-Ref
PHP4 constructor; Calls PHP 5 style constructor

return: WP_Object_Cache
since: 2.0.0

__construct()   X-Ref
Sets up object properties; PHP 5 style constructor

return: null|WP_Object_Cache If cache is disabled, returns null.
since: 2.0.8

__destruct()   X-Ref
Will save the object cache before object is completely destroyed.

Called upon object destruction, which should be when PHP ends.

return: bool True value. Won't be used by PHP
since: 2.0.8



Generated: Thu Nov 21 01:00:57 2024 Cross-referenced by PHPXref 0.7.1