You are here

public function DrupalMemcacheBase::get in Zircon Profile 8

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

Retrieves a value from Memcache.

Parameters

string $key: The key with which the item was stored.

Return value

mixed The item that was originally saved, or FALSE otherwise.

Overrides DrupalMemcacheInterface::get

File

modules/memcache/src/DrupalMemcacheBase.php, line 65
Contains \Drupal\memcache\DrupalMemcacheBase.

Class

DrupalMemcacheBase
Class DrupalMemcacheBase.

Namespace

Drupal\memcache

Code

public function get($key) {
  $full_key = $this
    ->key($key);
  $track_errors = ini_set('track_errors', '1');
  $php_errormsg = '';
  $result = @$this->memcache
    ->get($full_key);
  if (!empty($php_errormsg)) {
    register_shutdown_function('memcache_log_warning', LogLevel::WARNING, 'Exception caught in DrupalMemcacheBase::get: !msg', array(
      '!msg' => $php_errormsg,
    ));
    $php_errormsg = '';
  }
  ini_set('track_errors', $track_errors);
  return $result;
}