__construct() public method

public __construct ( Nette\Caching\IStorage $storage, $namespace = NULL )
$storage Nette\Caching\IStorage
Beispiel #1
0
 public function __construct(Settings $settings)
 {
     $storage = new FileStorage($settings->temp_dir);
     $this->settings = $settings;
     parent::__construct($storage);
     $this->cache_data = $this->load($this->settings->cache_name);
     if ($this->cache_data === null) {
         $this->save($this->settings->cache_name, array());
         $this->cache_data = array();
     }
 }
Beispiel #2
0
 /**
  * QCache constructor.
  *
  * @param string $type
  * @param string $namespace
  * @param BootLoader $bootLoader
  */
 public function __construct(string $type = 'memory', string $namespace = '', BootLoader $bootLoader)
 {
     $this->bootLoader = $bootLoader;
     if ($type == 'file') {
         $storage = new FileStorage($this->getCacheDir());
     } elseif ($type == 'ram') {
         $storage = new MemoryStorage();
     } else {
         $storage = ($server = $this->getMemCachedServer()) ? new MemcachedStorage($server['host'], $server['port'], $server['prefix']) : new MemoryStorage();
     }
     parent::__construct($storage, $namespace);
 }
Beispiel #3
0
 public function __construct(Caching\IStorage $storage, $hour = '14:45')
 {
     parent::__construct($storage, "Pto.Bank");
     $this->hourRefresh = $hour;
 }
Beispiel #4
0
 /**
  * New instance of Cache
  *
  * @param string $namespace     [optional] Cache namespace
  */
 public function __construct($namespace = NULL)
 {
     $storage = new FileStorage(sys_get_temp_dir());
     parent::__construct($storage, $namespace);
 }
Beispiel #5
0
 public function __construct(Nette\Caching\IStorage $storage, \DateTime $date = NULL)
 {
     $suffix = $date === NULL ? NULL : $date->format('Y-m-d');
     parent::__construct($storage, __NAMESPACE__ . $suffix);
 }