Files
IPB/system/Data/Cache/None.php
T
2025-12-19 05:32:19 -08:00

154 lines
2.6 KiB
PHP

<?php
/**
* @brief Dummy Cache Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @since 17 Sept 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Data\Cache;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Dummy Storage Class
*/
class _None extends \IPS\Data\Cache
{
/**
* Constructor
*
* @param array $configuration Configuration
* @return void
* @note Overridden for performance reasons
*/
public function __construct( $configuration )
{
}
/**
* Magic Method: Get
*
* @param string $key Key
* @return string Value from the _datastore
* @throws \OutOfRangeException
* @note Overridden for performance reasons
*/
public function __get( $key )
{
throw new \OutOfRangeException;
}
/**
* Magic Method: Set
*
* @param string $key Key
* @param string $value Value
* @return void
* @note Overridden for performance reasons
*/
public function __set( $key, $value )
{
}
/**
* Magic Method: Isset
*
* @param string $key Key
* @return bool
* @note Overridden for performance reasons
*/
public function __isset( $key )
{
return FALSE;
}
/**
* Magic Method: Unset
*
* @param string $key Key
* @return void
* @note Overridden for performance reasons
*/
public function __unset( $key )
{
}
/**
* Server supports this method?
*
* @return bool
*/
public static function supported()
{
return TRUE;
}
/**
* Abstract Method: Get
*
* @param string $key Key
* @return string Value from the _datastore
*/
protected function get( $key )
{
throw new \RuntimeException;
}
/**
* Abstract Method: Set
*
* @param string $key Key
* @param string $value Value
* @return bool
*/
protected function set( $key, $value )
{
return FALSE;
}
/**
* Abstract Method: Exists?
*
* @param string $key Key
* @return bool
*/
protected function exists( $key )
{
return FALSE;
}
/**
* Abstract Method: Delete
*
* @param string $key Key
* @return bool
*/
protected function delete( $key )
{
return TRUE;
}
/**
* Abstract Method: Clear All Caches
*
* @return void
*/
public function clearAll()
{
parent::clearAll();
try
{
\IPS\Db::i()->delete( 'core_cache' );
}
catch ( \IPS\Db\Exception $e ){}
}
}