You are here

public function Redis_AbstractBackend::getKey in Redis 7.3

Same name and namespace in other branches
  1. 7.2 lib/Redis/AbstractBackend.php \Redis_AbstractBackend::getKey()

Get prefixed key

Parameters

string|string[] $parts: Arbitrary number of strings to compose the key

Return value

string

Overrides Redis_BackendInterface::getKey

30 calls to Redis_AbstractBackend::getKey()
Redis_Cache_PhpRedis::delete in lib/Redis/Cache/PhpRedis.php
Redis_Cache_PhpRedis::deleteByPrefix in lib/Redis/Cache/PhpRedis.php
Redis_Cache_PhpRedis::deleteMultiple in lib/Redis/Cache/PhpRedis.php
Redis_Cache_PhpRedis::flush in lib/Redis/Cache/PhpRedis.php
Redis_Cache_PhpRedis::flushVolatile in lib/Redis/Cache/PhpRedis.php

... See full list

1 method overrides Redis_AbstractBackend::getKey()
Redis_Lock_DefaultBackend::getKey in lib/Redis/Lock/DefaultBackend.php
Generate a redis key name for the current lock name

File

lib/Redis/AbstractBackend.php, line 83

Class

Redis_AbstractBackend

Code

public function getKey($parts = array()) {
  $key = array();
  if (null !== $this->prefix) {
    $key[] = $this->prefix;
  }
  if (null !== $this->namespace) {
    $key[] = $this->namespace;
  }
  if ($parts) {
    if (is_array($parts)) {
      foreach ($parts as $part) {
        if ($part) {
          $key[] = $part;
        }
      }
    }
    else {
      $key[] = $parts;
    }
  }
  return implode(self::KEY_SEPARATOR, array_filter($key));
}