public function getKey(array $params): string
    {
        // Push current options to the list of
        // params to ensure unique cache key for
        // each set of options.
        $params[] = $this->options;

        $params = json_encode($params);
        $params = $params ?: microtime();
        $params = md5($params);

        $result = $this->name . '_' . $params;

        return $result;
    }
public function getKey(array $params): string
    {
        // Push current options to the list of
        // params to ensure unique cache key for
        // each set of options.
        $params[] = $this->options;

        $params = json_encode($params);
        $params = $params ?: microtime();
        $params = md5($params);

        $result = $this->name . '_' . $params;

        return $result;
    }
public function getKey ( array $ params ) : string { // Push current options to the list of // params to ensure unique cache key for // each set of options. $ params [ ] = $ this -> options ; $ params = json_encode ( $ params ) ; $ params = $ params ? : microtime ( ) ; $ params = md5 ( $ params ) ; $ result = $ this -> name . '_' . $ params ; return $ result ; }
Generate cache key

In order to avoid hardcoding any particular values
in the cache key, we instead rely on a given array
of parameters.  The array will be converted to
a string via json_encode() and shortened using an
md5 checksum.

For those cases where json_encode() fails, the current
microtime() will be used, as it's better to have at
least some cache key than nothing at all.

Name of the current cache instance is used as a prefix.
And just for convenience, the array of current instance
options is appended to key parameters.

@param mixed[] $params Parameters for key generation
@return string
Generate cache key