You are here

class CacheDecorator in Auth0 Single Sign On 8.2

Hierarchy

Expanded class hierarchy of CacheDecorator

1 file declares its use of CacheDecorator
JWKTests.php in vendor/auth0/auth0-php/tests/API/Helpers/JWKTests.php

File

vendor/auth0/auth0-php/tests/Helpers/Cache/CacheDecorator.php, line 7

Namespace

Auth0\Tests
View source
class CacheDecorator implements CacheHandler {
  protected $cache;
  protected $counter = [];
  public function __construct(CacheHandler $cache) {
    $this->cache = $cache;
  }
  public function get($key) {
    $this
      ->addCount('get');
    return $this->cache
      ->get($key);
  }
  public function delete($key) {
    $this
      ->addCount('delete');
    return $this->cache
      ->delete($key);
  }
  public function set($key, $value) {
    $this
      ->addCount('set');
    return $this->cache
      ->set($key, $value);
  }
  private function addCount($method) {
    if (!isset($this->counter[$method])) {
      $this->counter[$method] = 0;
    }
    $this->counter[$method]++;
  }
  public function count($method) {
    if (!isset($this->counter[$method])) {
      return null;
    }
    return $this->counter[$method];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheDecorator::$cache protected property
CacheDecorator::$counter protected property
CacheDecorator::addCount private function
CacheDecorator::count public function
CacheDecorator::delete public function Overrides CacheHandler::delete
CacheDecorator::get public function Overrides CacheHandler::get
CacheDecorator::set public function Overrides CacheHandler::set
CacheDecorator::__construct public function