mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-02 18:38:48 +03:00
Added cache locker
This commit is contained in:
parent
723e0afa4e
commit
ebce312d1a
2 changed files with 58 additions and 5 deletions
|
|
@ -2666,18 +2666,36 @@ class Actions
|
|||
$sValue = '';
|
||||
if (!$sForce)
|
||||
{
|
||||
$iTime = $oCacher->GetTimer($bLongCache ? $sDomainLongKeyValue : $sDomainKeyValue);
|
||||
if (0 < $iTime && \time() < $iTime + (60 * ($bLongCache ? 60 * 24 : 1)) * ($bLongCache ? $iLongCacheTimeInDays : $iFastCacheTimeInMin))
|
||||
if ($bLongCache)
|
||||
{
|
||||
$sValue = $oCacher->Get($bLongCache ? $sDomainLongKeyValue : $sDomainKeyValue);
|
||||
$bLock = $oCacher->GetLock($sDomainLongKeyValue);
|
||||
$iTime = $bLock ? 0 : $oCacher->GetTimer($sDomainLongKeyValue);
|
||||
|
||||
if ($bLock || (0 < $iTime && \time() < $iTime + (60 * 60 * 24) * $iLongCacheTimeInDays))
|
||||
{
|
||||
$sValue = $oCacher->Get($sDomainLongKeyValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$iTime = $oCacher->GetTimer($sDomainKeyValue);
|
||||
if (0 < $iTime && \time() < $iTime + 60 * $iFastCacheTimeInMin)
|
||||
{
|
||||
$sValue = $oCacher->Get($sDomainKeyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 === \strlen($sValue))
|
||||
{
|
||||
if ($bLongCache && !$oCacher->SetTimer($sDomainLongKeyValue))
|
||||
if ($bLongCache)
|
||||
{
|
||||
return 'NO';
|
||||
if (!$oCacher->SetTimer($sDomainLongKeyValue))
|
||||
{
|
||||
return 'NO';
|
||||
}
|
||||
|
||||
$oCacher->SetLock($sDomainLongKeyValue);
|
||||
}
|
||||
|
||||
$iCode = 0;
|
||||
|
|
@ -2698,6 +2716,11 @@ class Actions
|
|||
|
||||
$oCacher->Set($sDomainKeyValue, $sValue);
|
||||
$oCacher->Set($sDomainLongKeyValue, $sValue);
|
||||
|
||||
if ($bLongCache)
|
||||
{
|
||||
$oCacher->RemoveLock($sDomainLongKeyValue);
|
||||
}
|
||||
}
|
||||
|
||||
return $sValue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue