PHP 클래스 Contao\Cache

The class functions as a global cache container where you can store data that is reused by the application. The cache content is not persisted, so once the process is completed, the data is gone. Usage: public function getResult() { if (!Cache::has('result')) { Cache::set('result') = $this->complexMethod(); } return Cache::get('result'); }
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$arrData array The cache data
$objInstance Cache Object instance (Singleton)

공개 메소드들

메소드 설명
__clone ( ) Prevent cloning of the object (Singleton)
__get ( string $strKey ) : mixed | null Return a cache entry
__isset ( string $strKey ) : boolean Check whether a key is set
__set ( string $strKey, mixed $varValue ) Add a cache entry
__unset ( string $strKey ) Remove a cache entry
get ( string $strKey ) : mixed Return a cache entry
getInstance ( ) : Cache Instantiate the cache object (Factory)
has ( string $strKey ) : boolean Check whether a key is set
remove ( string $strKey ) Remove a cache entry
set ( string $strKey, mixed $varValue ) Add a cache entry

보호된 메소드들

메소드 설명
__construct ( ) Prevent direct instantiation (Singleton)

메소드 상세

__clone() 최종 공개 메소드

Prevent cloning of the object (Singleton)
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Cache class is now static.
final public __clone ( )

__construct() 보호된 메소드

Prevent direct instantiation (Singleton)
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Cache class is now static.
protected __construct ( )

__get() 공개 메소드

Return a cache entry
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Cache::get() instead.
public __get ( string $strKey ) : mixed | null
$strKey string The cache key
리턴 mixed | null The cached data

__isset() 공개 메소드

Check whether a key is set
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Cache::has() instead.
public __isset ( string $strKey ) : boolean
$strKey string The cache key
리턴 boolean True if the key is set

__set() 공개 메소드

Add a cache entry
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Cache::set() instead.
public __set ( string $strKey, mixed $varValue )
$strKey string The cache key
$varValue mixed The data to be stored

__unset() 공개 메소드

Remove a cache entry
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. Use Cache::remove() instead.
public __unset ( string $strKey )
$strKey string The cache key

get() 공개 정적인 메소드

Return a cache entry
public static get ( string $strKey ) : mixed
$strKey string The cache key
리턴 mixed The cached data

getInstance() 공개 정적인 메소드

Instantiate the cache object (Factory)
사용 중단: Deprecated since Contao 4.0, to be removed in Contao 5.0. The Cache class is now static.
public static getInstance ( ) : Cache
리턴 Cache The object instance

has() 공개 정적인 메소드

Check whether a key is set
public static has ( string $strKey ) : boolean
$strKey string The cache key
리턴 boolean True if the key is set

remove() 공개 정적인 메소드

Remove a cache entry
public static remove ( string $strKey )
$strKey string The cache key

set() 공개 정적인 메소드

Add a cache entry
public static set ( string $strKey, mixed $varValue )
$strKey string The cache key
$varValue mixed The data to be cached

프로퍼티 상세

$arrData 보호되어 있는 정적으로 프로퍼티

The cache data
protected static array $arrData
리턴 array

$objInstance 보호되어 있는 정적으로 프로퍼티

Object instance (Singleton)
protected static Cache,contao $objInstance
리턴 Cache