[hashKey description]

@since  1.0.0

@param  [type] $key [description]

@return [type]      [description]
174535
public function hashKey( $key = null ) {
		$key = $key ? $this->sanitizeKey( $key ) : $this->getKey();
		return md5( $key );
	}
520517
public function get_hash($key = 0)
	{
		$hashes = $this->get_hashes();
		if (isset($hashes[$key]))
		{
			return $hashes[$key];
		}

		return null;
	}
1290830
protected function getRealKey($key)
    {
        if ($alias = array_search($key, $this->aliases, true)) {
            $key = $alias;
        }

        return $key;
    }
717547
public function isLast($key)
    {
        if (null === $this->lastKey) {
            end($this->hierarchy);
            $this->lastKey = key($this->hierarchy);
        }

        return $key === $this->lastKey;
    }
1332085
private function getKey ( $key = NULL ) {
        if ($key === NULL) {
            $key = $this->__keyName;
            return $this->getClassKey() . '_' . $this->$key;
        }
        return $this->getClassKey() . '_' . $key;
    }
1018365
private function __key($key)
    {
        if ($key instanceof AnObjectHandlable) {
            $key = $key->getHandle();
        } elseif (gettype($key) == 'object') {
            $key = spl_object_hash($key);
        }

        return $key;
    }
104701
public function getKey($key)
    {
        $key = strtolower($key);
        if (!isset($this->keys[$key])) {
            return null;
        }
        return (string)$this->keys[$key];
    }
964284
protected function parseKey(&$key) {
        $key   =  trim($key);
        if(!is_numeric($key) && !preg_match('/[,\'\"\*\(\)\[.\s]/',$key)) {
           $key = '['.$key.']';
        }
        return $key;   
    }
519305
private function hash($key)
    {
        $serverNum = count($this->conf['server']);
        $success = sprintf('%u', crc32($key)) % $serverNum;

        if (!isset($this->redis[$success]) || !is_object($this->redis[$success])) {
            $instance = new \Redis();

            $connectToRedisFunction = function ($host, $port, $isPersistentConnect) use ($instance) {
                if ($isPersistentConnect) {
                    return $instance->pconnect($host, $port, 1.5);
                } else {
                    return $instance->connect($host, $port, 1.5);
                }
            };

            $isPersistentConnect = !(isset($this->conf['server'][$success]['pconnect']) && $this->conf['server'][$success]['pconnect'] === false);
            $connectResult = $connectToRedisFunction($this->conf['server'][$success]['host'], $this->conf['server'][$success]['port'], $isPersistentConnect);

            $failOver = null;

            if (!$connectResult && !empty($this->conf['back'])) {
                $failOver = $this->conf['back'];
                $isPersistentConnect = !(isset($failOver['pconnect']) && $failOver['pconnect'] === false);
                $connectResult = $connectToRedisFunction($failOver['host'], $failOver['port'], $isPersistentConnect);
            }

            if (!$connectResult && $serverNum > 1) {
                $failOver = $success + 1;
                $failOver >= $serverNum && $failOver = $success - 1;
                $failOver = $this->conf['server'][$failOver];
                $isPersistentConnect = !(isset($failOver['pconnect']) && $failOver['pconnect'] === false);
                $connectResult = $connectToRedisFunction($failOver['host'], $failOver['port'], $isPersistentConnect);
            }

            if (!$connectResult) {
                Plugin::hook('cml.cache_server_down', [$this->conf['server'][$success]]);

                throw new CacheConnectFailException(Lang::get('_CACHE_CONNECT_FAIL_', 'Redis',
                    $this->conf['server'][$success]['host'] . ':' . $this->conf['server'][$success]['port']
                ));
            }

            $password = false;
            if (is_null($failOver)) {
                if (isset($this->conf['server'][$success]['password']) && !empty($this->conf['server'][$success]['password'])) {
                    $password = $this->conf['server'][$success]['password'];
                }

                if ($password && !$instance->auth($password)) {
                    throw new \RuntimeException('redis password error!');
                }

                isset($this->conf['server'][$success]['db']) && $instance->select($this->conf['server'][$success]['db']);
            } else {
                if (isset($failOver['password']) && !empty($failOver['password'])) {
                    $password = $failOver['password'];
                }

                if ($password && !$instance->auth($password)) {
                    throw new \RuntimeException('redis password error!');
                }

                isset($failOver['db']) && $instance->select($failOver['db']);

                Log::emergency('redis server down', ['downServer' => $this->conf['server'][$success], 'failOverTo' => $failOver]);
                Plugin::hook('cml.redis_server_down_fail_over', ['downServer' => $this->conf['server'][$success], 'failOverTo' => $failOver]);
            }

            $instance->setOption(\Redis::OPT_PREFIX, $this->conf['prefix']);
            $this->redis[$success] = $instance;
        }
        return $this->redis[$success];
    }
1205310
protected function parseKey($key)
    {
        if (!isset($this->keys[$key])) {
            $this->keys[$key] = explode($this->separator, $key);
        }

        return $this->keys[$key];
    }
288938
public function offsetGet($key)
    {
        $i = -1;
        foreach ($this->hash as $obj) {
            if ($key === ++$i) {
                return $this->hash[$obj];
            }
        }

        return null;
    }
179621
public function offsetGet($key) {
		$hashCode = HashUtils::hashCode($key);
		if (isset($this->values[$hashCode])) {
			return $this->values[$hashCode];
		}
		return null;
	}
127627
protected function modifyKey(string $key)
    {
        $newKey = $key;
        if (($this->getOptions() & self::KEY_LOWER) > 0) {
            $newKey = strtolower($key);
        } elseif (($this->getOptions() & self::KEY_UPPER) > 0) {
            $newKey = strtoupper($key);
        }

        return $newKey;
    }
1102849
public function getConnectionByKey($key)
    {
        $hash = $this->strategy->getSlotByKey($key);
        $node = $this->distributor->getBySlot($hash);

        return $node;
    }
348482
protected function getShard($key)
    {
        /*
         * The hash is so we can deterministically randomize the spread of keys
         * over servers: if we were to just spread them based on key name, we
         * may end up with a large chunk of similarly prefixed keys on the same
         * server. Hashing the key will ensure similar looking keys can still
         * result in very different values, yet they result will be the same
         * every time it's repeated for the same key.
         * Since we don't use the hash for encryption, the fastest algorithm
         * will do just fine here.
         */
        $hash = crc32($key);

        // crc32 on 32-bit machines can produce a negative int
        $hash = abs($hash);

        $index = $hash % count($this->caches);

        return $this->caches[$index];
    }
593468
public function parseKey($key)
    {
        if ($key === 'number') {
            return $this->getManager()->getNumberManager()->parseKey();
        }

        return parent::parseKey($key);
    }
1324419
public function key(string $key = null)
    {
        if ($key) {
            $this->field['key'] = $key;

            return $this;
        }

        return $this->field['key'];
    }