Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+19 -18
View File
@@ -2,9 +2,9 @@
/**
* @brief APC Caching Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 17 Sept 2013
* @version SVN_VERSION_NUMBER
*/
@@ -30,7 +30,7 @@ class _Apc extends \IPS\Data\Cache
*/
public static function supported()
{
return function_exists('apc_fetch');
return function_exists('apcu_fetch');
}
/**
@@ -43,27 +43,28 @@ class _Apc extends \IPS\Data\Cache
{
if( isset( $this->cache[ $key ] ) )
{
\IPS\Log::i( LOG_DEBUG )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Get {$key} from APC (already loaded)", 'cache' );
\IPS\Log::debug( "Get {$key} from APC (already loaded)", 'cache' );
return $this->cache[ $key ];
}
\IPS\Log::i( LOG_DEBUG )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Get {$key} from APC", 'cache' );
\IPS\Log::debug( "Get {$key} from APC", 'cache' );
$this->cache[ $key ] = apc_fetch( \IPS\SUITE_UNIQUE_KEY . '_' . $key );
$this->cache[ $key ] = apcu_fetch( \IPS\SUITE_UNIQUE_KEY . '_' . $key );
return $this->cache[ $key ];
}
/**
* Abstract Method: Set
*
* @param string $key Key
* @param string $value Value
* @param string $key Key
* @param string $value Value
* @para, \IPS\DateTime $expire Expreation time, or NULL for no expiration
* @return bool
*/
protected function set( $key, $value )
protected function set( $key, $value, \IPS\DateTime $expire = NULL )
{
\IPS\Log::i( LOG_DEBUG )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Set {$key} in APC", 'cache' );
return (bool) apc_store( \IPS\SUITE_UNIQUE_KEY . '_' . $key, $value );
\IPS\Log::debug( "Set {$key} in APC", 'cache' );
return (bool) apcu_store( \IPS\SUITE_UNIQUE_KEY . '_' . $key, $value, $expire ? ( $expire->getTimestamp() - time() ) : 0 );
}
/**
@@ -76,13 +77,13 @@ class _Apc extends \IPS\Data\Cache
{
if( isset( $this->cache[ $key ] ) )
{
\IPS\Log::i( LOG_DEBUG )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Check exists {$key} from APC (already loaded)", 'cache' );
return TRUE;
\IPS\Log::debug( "Check exists {$key} from APC (already loaded)", 'cache' );
return ( $this->cache[ $key ] === FALSE ) ? FALSE : TRUE;
}
\IPS\Log::i( LOG_DEBUG )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Check exists {$key} from APC", 'cache' );
\IPS\Log::debug( "Check exists {$key} from APC", 'cache' );
$result = apc_fetch( \IPS\SUITE_UNIQUE_KEY . '_' . $key, $exists );
$result = apcu_fetch( \IPS\SUITE_UNIQUE_KEY . '_' . $key, $exists );
if ( $exists )
{
$this->cache[ $key ] = $result;
@@ -102,8 +103,8 @@ class _Apc extends \IPS\Data\Cache
*/
protected function delete( $key )
{
\IPS\Log::i( LOG_DEBUG )->setIpAddress( $_SERVER['REMOTE_ADDR'] )->write( "Delete {$key} from APC", 'cache' );
return (bool) apc_delete( \IPS\SUITE_UNIQUE_KEY . '_' . $key );
\IPS\Log::debug( "Delete {$key} from APC", 'cache' );
return (bool) apcu_delete( \IPS\SUITE_UNIQUE_KEY . '_' . $key );
}
/**
@@ -114,6 +115,6 @@ class _Apc extends \IPS\Data\Cache
public function clearAll()
{
parent::clearAll();
apc_clear_cache();
apcu_clear_cache();
}
}