WP_Object_Cache::add

SummerySummery

Adds data to the cache if it doesn’t already exist.

Syntax

WP_Object_Cache::add( int|string $key, mixed $data, string $group = 'default', int $expire )

ParametersParameters

$key

(int|string) (Required) What to call the contents in the cache.

$data

(mixed) (Required) The contents to store in the cache.

$group

(string) (Optional) Where to group the cache contents.

Default value: 'default'

$expire

(int) (Optional) When to expire the cache contents. Default 0 (no expiration).

ReturnReturn

(bool) True on success, false if cache key and group already exist.

SourceSource

File: wp-includes/class-wp-object-cache.php


			

ChangelogChangelog

Changelog
Version Description
2.0.0 Introduced.
Scroll to Top