本文整理汇总了PHP中Nette\Caching\Cache::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::__construct方法的具体用法?PHP Cache::__construct怎么用?PHP Cache::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Caching\Cache
的用法示例。
在下文中一共展示了Cache::__construct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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();
}
}
示例2: __construct
/**
* 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);
}
示例3: __construct
public function __construct(Caching\IStorage $storage, $hour = '14:45')
{
parent::__construct($storage, "Pto.Bank");
$this->hourRefresh = $hour;
}
示例4: __construct
/**
* 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);
}
示例5: __construct
public function __construct(Nette\Caching\IStorage $storage, \DateTime $date = NULL)
{
$suffix = $date === NULL ? NULL : $date->format('Y-m-d');
parent::__construct($storage, __NAMESPACE__ . $suffix);
}