buildKey() public method

If the given key is a string containing alphanumeric characters only and no more than 32 characters, then the key will be returned back prefixed with [[keyPrefix]]. Otherwise, a normalized key is generated by serializing the given key, applying MD5 hashing, and prefixing with [[keyPrefix]].
public buildKey ( mixed $key ) : string
$key mixed the key to be normalized
return string the generated cache key
コード例 #1
0
ファイル: Cache.php プロジェクト: urbanindo/yii2-s3cache
 /**
  * Builds a normalized cache key from a given key.
  *
  * This will baypass if the we don't want to normalize the key.
  *
  * @param mixed $key the key to be normalized
  * @return string the generated cache key
  */
 public function buildKey($key)
 {
     if (!is_string($key) || $this->hashKey) {
         return parent::buildKey($key);
     }
     return $this->keyPrefix . $key;
 }
コード例 #2
0
 /**
  * @param mixed $key
  *
  * @return string
  *
  * @see yii\caching\Cache::buildKey()
  */
 public function buildKey($key)
 {
     return $this->cache->buildKey($key);
 }