You are here

public function DriverBase::get in Memcache API and Integration 8.2

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

src/Driver/DriverBase.php, line 85

Class

DriverBase
Class DriverBase.

Namespace

Drupal\memcache\Driver

Code

public function get($key) {
  $collect_stats = $this
    ->statsInit();
  $full_key = $this
    ->key($key);
  $result = $this->memcache
    ->get($full_key);
  if ($collect_stats) {
    $this
      ->statsWrite('get', 'cache', [
      $full_key => (bool) $result,
    ]);
  }
  return $result;
}