lithium\storage\Cache::key PHP Method

key() public static method

Generates the cache key.
public static key ( mixed $key, array $data = [] ) : string
$key mixed A string (or lambda/closure that evaluates to a string) that will be used as the cache key.
$data array If a lambda/closure is used as a key and requires arguments, pass them in here.
return string The generated cache key.
    public static function key($key, $data = array())
    {
        return is_object($key) ? $key($data) : $key;
    }

Usage Example

 public function testKeyWithClosureAndArguments()
 {
     $value = 'closure argument';
     $key = function ($value) {
         return $value;
     };
     $result = Cache::key($key($value));
     $expected = 'closure argument';
     $this->assertIdentical($expected, $result);
 }