exists() публичный Метод

This can be faster than getting the value from the cache if the data is big. In case a cache does not support this feature natively, this method will try to simulate it but has no performance improvement over getting it. Note that this method does not check whether the dependency associated with the cached data, if there is any, has changed. So a call to [[get]] may return false while exists returns true.
public exists ( mixed $key ) : boolean
$key mixed a key identifying the cached value. This can be a simple string or a complex data structure consisting of factors representing the key.
Результат boolean true if a value exists in cache, false if the value is not in the cache or expired.
Пример #1
0
 /**
  * @param callable $callback
  */
 protected function cacheIterator($callback)
 {
     $i = 0;
     while (true) {
         $key = sprintf('assignments-%d', $i);
         if ($this->cache->exists($key)) {
             call_user_func($callback, $key);
         } else {
             break;
         }
         $i++;
     }
 }
 /**
  * @param mixed $key
  *
  * @return boolean
  *
  * @see yii\caching\Cache::exist()
  */
 public function exists($key)
 {
     return $this->cache->exists($key);
 }
 /**
  * Check exist name
  * @param $name
  * @return mixed
  */
 public function exists($name)
 {
     return $this->_cache->exists($this->prefix . $name);
 }