You are here

public function DrupalMemcacheInterface::set in Memcache API and Integration 8.2

Adds an item into memcache.

Parameters

string $key: The string with which you will retrieve this item later.

mixed $value: The item to be stored.

int $exp: Parameter expire is expiration time in seconds. If it's 0, the item never expires (but memcached server doesn't guarantee this item to be stored all the time, it could be deleted from the cache to make place for other items).

bool $flag: If using the older memcache PECL extension as opposed to the newer memcached PECL extension, the MEMCACHE_COMPRESSED flag can be set to use zlib to store a compressed copy of the item. This flag option is completely ignored when using the newer memcached PECL extension.

Return value

bool Whether or not the add was successful.

2 methods override DrupalMemcacheInterface::set()
MemcachedDriver::set in src/Driver/MemcachedDriver.php
Adds an item into memcache.
MemcacheDriver::set in src/Driver/MemcacheDriver.php
Adds an item into memcache.

File

src/DrupalMemcacheInterface.php, line 31

Class

DrupalMemcacheInterface
Class DrupalMemcacheInterface.

Namespace

Drupal\memcache

Code

public function set($key, $value, $exp = 0, $flag = FALSE);