You are here

public function DrupalMemcached::set in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 modules/memcache/src/DrupalMemcached.php \Drupal\memcache\DrupalMemcached::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.

Overrides DrupalMemcacheInterface::set

File

modules/memcache/src/DrupalMemcached.php, line 58
Contains \Drupal\memcache\DrupalMemcached.

Class

DrupalMemcached
Class DrupalMemcached.

Namespace

Drupal\memcache

Code

public function set($key, $value, $exp = 0, $flag = FALSE) {
  $full_key = $this
    ->key($key);
  return $this->memcache
    ->set($full_key, $value, $exp);
}