src/Model/Behavior/CacheableBehavior.php
public function cacheKey(Model $model, $keys, $prefix = true)
    {

        // TranslateBehavior support
        if (!empty($model->locale)) {
            $keys = array_merge((array)$model->locale, (array)$keys);
        }

        if (is_array($keys)) {
            $key = array_shift($keys);

            if ($keys) {
                foreach ($keys as $value) {
                    if (is_array($value)) {
                        $key .= '-' . md5(json_encode($value));
                    } else if ($value) {
                        $key .= '-' . $value;
                    }
                }
            }
        } else {
            $key = (string)$keys;
        }

        if ($prefix) {
            $key = (string)$this->settings[$model->alias]['prefix'] . $key;
        }

        // Replace AppModel with the current Model so we don't run into conflicts
        $key = str_replace(array('AppModel', '::'), array($model->alias, '_'), $key);

        return $key;
    }
public function cacheKey(Model $model, $keys, $prefix = true)
    {

        // TranslateBehavior support
        if (!empty($model->locale)) {
            $keys = array_merge((array)$model->locale, (array)$keys);
        }

        if (is_array($keys)) {
            $key = array_shift($keys);

            if ($keys) {
                foreach ($keys as $value) {
                    if (is_array($value)) {
                        $key .= '-' . md5(json_encode($value));
                    } else if ($value) {
                        $key .= '-' . $value;
                    }
                }
            }
        } else {
            $key = (string)$keys;
        }

        if ($prefix) {
            $key = (string)$this->settings[$model->alias]['prefix'] . $key;
        }

        // Replace AppModel with the current Model so we don't run into conflicts
        $key = str_replace(array('AppModel', '::'), array($model->alias, '_'), $key);

        return $key;
    }
public function cacheKey ( Model $ model , $ keys , $ prefix = true ) { // TranslateBehavior support
 if ( ! empty ( $ model -> locale ) ) { $ keys = array_merge ( ( array ) $ model -> locale , ( array ) $ keys ) ; } if ( is_array ( $ keys ) ) { $ key = array_shift ( $ keys ) ; if ( $ keys ) { foreach ( $ keys as $ value ) { if ( is_array ( $ value ) ) { $ key .= '-' . md5 ( json_encode ( $ value ) ) ; } else if ( $ value ) { $ key .= '-' . $ value ; } } } } else { $ key = ( string ) $ keys ; } if ( $ prefix ) { $ key = ( string ) $ this -> settings [ $ model -> alias ] [ 'prefix' ] . $ key ; } // Replace AppModel with the current Model so we don't run into conflicts
 $ key = str_replace ( array ( 'AppModel' , '::' ) , array ( $ model -> alias , '_' ) , $ key ) ; return $ key ; }
Generate a cache key. The first index should be the method name, the other indices should be unique values.

@param Model $model
@param array|string $keys
@param bool $prefix
@return string
Generate a cache key . The first index should be the method name the other indices should be unique values .