You are here

public function DrupalMemcacheInterface::set in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/src/DrupalMemcacheInterface.php \Drupal\memcache\DrupalMemcacheInterface::set()

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()
DrupalMemcache::set in modules/memcache/src/DrupalMemcache.php
Adds an item into memcache.
DrupalMemcached::set in modules/memcache/src/DrupalMemcached.php
Adds an item into memcache.

File

modules/memcache/src/DrupalMemcacheInterface.php, line 36
Contains \Drupal\memcache\DrupalMemcacheInterface.

Class

DrupalMemcacheInterface
Class DrupalMemcacheInterface.

Namespace

Drupal\memcache

Code

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