2020-04-13 15:30:52 +02:00
|
|
|
<?php
|
|
|
|
|
|
2022-12-22 21:23:22 +01:00
|
|
|
use Smarty\Template;
|
|
|
|
|
use Smarty\Template\Cached;
|
|
|
|
|
|
2020-04-13 15:30:52 +02:00
|
|
|
require_once SMARTY_DIR . '../demo/plugins/cacheresource.apc.php';
|
|
|
|
|
|
|
|
|
|
class Smarty_CacheResource_Apctest extends Smarty_CacheResource_Apc
|
|
|
|
|
{
|
|
|
|
|
public $lockTime = 0;
|
|
|
|
|
|
2022-12-22 21:23:22 +01:00
|
|
|
public function hasLock(Smarty $smarty, Cached $cached)
|
2020-04-13 15:30:52 +02:00
|
|
|
{
|
|
|
|
|
if ($this->lockTime) {
|
|
|
|
|
$this->lockTime--;
|
|
|
|
|
if (!$this->lockTime) {
|
|
|
|
|
$this->releaseLock($smarty, $cached);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return parent::hasLock($smarty, $cached);
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-22 21:23:22 +01:00
|
|
|
public function get(Template $_template)
|
2020-04-13 15:30:52 +02:00
|
|
|
{
|
|
|
|
|
$this->contents = array();
|
|
|
|
|
$this->timestamps = array();
|
|
|
|
|
$t = $this->getContent($_template);
|
|
|
|
|
|
|
|
|
|
return $t ? $t : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __sleep()
|
|
|
|
|
{
|
|
|
|
|
return array();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function __wakeup()
|
|
|
|
|
{
|
|
|
|
|
$this->__construct();
|
|
|
|
|
}
|
|
|
|
|
}
|