summaryrefslogtreecommitdiff
path: root/tests/UnitTests/CacheResourceTests/PDO/cacheresource.pdotest.php
blob: 19feac79c6c1141beca5c3287dd6a187c84bc306 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

use Smarty\Template\Cached;

require_once __DIR__ . '/../_shared/cacheresources/cacheresource.pdo.php';

class Smarty_CacheResource_Pdotest extends Smarty_CacheResource_Pdo
{
    public $lockTime = 0;


    public function hasLock(\Smarty\Smarty $smarty, Cached $cached)
    {
        if ($this->lockTime) {
            $this->lockTime--;
            if (!$this->lockTime) {
                $this->releaseLock($smarty, $cached);
            }
        }
        return parent::hasLock($smarty, $cached);
    }
}