mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 22:47:03 +03:00
Bugfixes and more conversions to PHP 7
This commit is contained in:
parent
2cada68f41
commit
3a7ec4ecb0
100 changed files with 238 additions and 992 deletions
|
|
@ -23,12 +23,7 @@ class APC implements \MailSo\Cache\DriverInterface
|
|||
*/
|
||||
private $sKeyPrefix;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
* @param string $sKeyPrefix = ''
|
||||
*/
|
||||
private function __construct($sKeyPrefix = '')
|
||||
private function __construct(string $sKeyPrefix = '')
|
||||
{
|
||||
$this->sKeyPrefix = $sKeyPrefix;
|
||||
if (!empty($this->sKeyPrefix))
|
||||
|
|
@ -38,52 +33,28 @@ class APC implements \MailSo\Cache\DriverInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKeyPrefix = ''
|
||||
*
|
||||
* @return \MailSo\Cache\Drivers\APC
|
||||
*/
|
||||
public static function NewInstance($sKeyPrefix = '')
|
||||
public static function NewInstance(string $sKeyPrefix = '') : self
|
||||
{
|
||||
return new self($sKeyPrefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*/
|
||||
public function Set($sKey, $sValue) : bool
|
||||
public function Set(string $sKey, string $sValue) : bool
|
||||
{
|
||||
return \apc_store($this->generateCachedKey($sKey), (string) $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function Get($sKey)
|
||||
public function Get(string $sKey) : string
|
||||
{
|
||||
$sValue = \apc_fetch($this->generateCachedKey($sKey));
|
||||
return \is_string($sValue) ? $sValue : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function Delete($sKey)
|
||||
public function Delete(string $sKey) : void
|
||||
{
|
||||
\apc_delete($this->generateCachedKey($sKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTimeToClearInHours = 24
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function GC($iTimeToClearInHours = 24)
|
||||
public function GC(int $iTimeToClearInHours = 24) : bool
|
||||
{
|
||||
if (0 === $iTimeToClearInHours)
|
||||
{
|
||||
|
|
@ -93,12 +64,7 @@ class APC implements \MailSo\Cache\DriverInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateCachedKey($sKey)
|
||||
private function generateCachedKey(string $sKey) : string
|
||||
{
|
||||
return $this->sKeyPrefix.\sha1($sKey);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue