PHP Class Pimcore\Cache

Mostrar archivo Open project: pimcore/pimcore Class Usage Examples

Public Properties

Property Type Description
$cachePrefix string prefix which will be added to every item-key
$clearedTagsStack array Contains the tags which were already cleared
$defaultLifetime null
$ignoredTagsOnClear array items having one of the tags in this store are not cleared when calling self::clearTags() or self::clearTag()
$instance Zend_Cache_Core | Zend_Cache_Frontend Instance of the used cache-implementation
$logger Logger Contains the Logger, this is necessary because otherwise logging doesn't work in shutdown (missing reference)
$maxWriteToCacheItems integer How many items should stored to the cache within one process
$saveStack array Contains the items which should be written to the cache on shutdown. They are ordered respecting the priority

Protected Properties

Property Type Description
$_clearTagsOnShutdown array Items having tags which are in this array are cleared on shutdown \Pimcore::shutdown(); This is especially for the output-cache
$blackHoleCache Zend_Cache_Core
$enabled boolean
$forceImmediateWrite boolean if set to truq items are directly written into the cache, and do not get into the queue
$writeLockTimestamp integer contains the timestamp of the writeLockTime from the current process this is to recheck when removing the write lock (if the value is different -> higher) do not remove the lock because then another process has acquired a lock

Public Methods

Method Description
addClearTagOnShutdown ( $tag ) : void Adds a tag to the shutdown queue, see clearTagsOnShutdown
addClearedTag ( string $tag )
addIgnoredTagOnClear ( $tag ) : void
clearAll ( ) : void Empty the cache
clearSaveStack ( )
clearTag ( string $tag ) : void Removes entries from the cache matching the given tag
clearTags ( array $tags = [] ) : void Removes entries from the cache matching the given tags
clearTagsOnShutdown ( ) : void Clears all tags stored in self::$_clearTagsOnShutdown, this function is executed in \Pimcore::shutdown()
disable ( ) : void Disables the complete pimcore cache
enable ( ) : void
getBlackHoleCache ( ) : Zend_Cache_Core | Zend_Cache_Frontend
getDefaultCache ( ) : Zend_Cache_Core | Zend_Cache_Frontend
getDefaultConfig ( string | null $adapter = null ) : array
getForceImmediateWrite ( ) : boolean
getInstance ( ) : Zend_Cache_Core | Zend_Cache_Frontend Returns a instance of the cache, if the instance isn't available it creates a new one
hasWriteLock ( ) : boolean
init ( )
initializeCache ( $config ) : Zend_Cache_Core | Zend_Cache_Frontend
load ( string $key, $doNotTestCacheValidity = false ) : mixed Returns the content of the requested cache entry
maintenance ( )
remove ( $key )
removeIgnoredTagOnClear ( $tag ) : void
removeWriteLock ( )
save ( $data, $key, array $tags = [], null $lifetime = null, integer $priority, boolean $force = false ) : boolean | void
setForceImmediateWrite ( boolean $forceImmediateWrite )
setWriteLock ( $force = false )
setZendFrameworkCaches ( null $cache = null )
test ( string $key ) : integer | boolean Get the last modified time for the requested cache entry
write ( ) : void Write the stack to the cache

Protected Methods

Method Description
normalizeConfig ( $config ) : mixed
storeToCache ( $data, $key, array $tags = [], null $lifetime = null, boolean $force = false ) : boolean | void Write's an item to the cache // don't use the logger inside here

Method Details

addClearTagOnShutdown() public static method

Adds a tag to the shutdown queue, see clearTagsOnShutdown
public static addClearTagOnShutdown ( $tag ) : void
$tag
return void

addClearedTag() public static method

public static addClearedTag ( string $tag )
$tag string

addIgnoredTagOnClear() public static method

public static addIgnoredTagOnClear ( $tag ) : void
$tag
return void

clearAll() public static method

Empty the cache
public static clearAll ( ) : void
return void

clearSaveStack() public method

public clearSaveStack ( )

clearTag() public static method

Removes entries from the cache matching the given tag
public static clearTag ( string $tag ) : void
$tag string
return void

clearTags() public static method

Removes entries from the cache matching the given tags
public static clearTags ( array $tags = [] ) : void
$tags array
return void

clearTagsOnShutdown() public static method

Clears all tags stored in self::$_clearTagsOnShutdown, this function is executed in \Pimcore::shutdown()
public static clearTagsOnShutdown ( ) : void
return void

disable() public static method

Disables the complete pimcore cache
public static disable ( ) : void
return void

enable() public static method

public static enable ( ) : void
return void

getBlackHoleCache() public static method

public static getBlackHoleCache ( ) : Zend_Cache_Core | Zend_Cache_Frontend
return Zend_Cache_Core | Zend_Cache_Frontend

getDefaultCache() public static method

public static getDefaultCache ( ) : Zend_Cache_Core | Zend_Cache_Frontend
return Zend_Cache_Core | Zend_Cache_Frontend

getDefaultConfig() public static method

public static getDefaultConfig ( string | null $adapter = null ) : array
$adapter string | null
return array

getForceImmediateWrite() public static method

public static getForceImmediateWrite ( ) : boolean
return boolean

getInstance() public static method

Returns a instance of the cache, if the instance isn't available it creates a new one
public static getInstance ( ) : Zend_Cache_Core | Zend_Cache_Frontend
return Zend_Cache_Core | Zend_Cache_Frontend

hasWriteLock() public static method

public static hasWriteLock ( ) : boolean
return boolean

init() public static method

public static init ( )

initializeCache() public static method

public static initializeCache ( $config ) : Zend_Cache_Core | Zend_Cache_Frontend
$config
return Zend_Cache_Core | Zend_Cache_Frontend

load() public static method

Returns the content of the requested cache entry
public static load ( string $key, $doNotTestCacheValidity = false ) : mixed
$key string
return mixed

maintenance() public static method

public static maintenance ( )

normalizeConfig() protected static method

protected static normalizeConfig ( $config ) : mixed
$config
return mixed

remove() public static method

public static remove ( $key )
$key

removeIgnoredTagOnClear() public static method

public static removeIgnoredTagOnClear ( $tag ) : void
$tag
return void

removeWriteLock() public static method

public static removeWriteLock ( )

save() public static method

public static save ( $data, $key, array $tags = [], null $lifetime = null, integer $priority, boolean $force = false ) : boolean | void
$data
$key
$tags array
$lifetime null
$priority integer
$force boolean
return boolean | void

setForceImmediateWrite() public static method

public static setForceImmediateWrite ( boolean $forceImmediateWrite )
$forceImmediateWrite boolean

setWriteLock() public static method

public static setWriteLock ( $force = false )

setZendFrameworkCaches() public static method

public static setZendFrameworkCaches ( null $cache = null )
$cache null

storeToCache() protected static method

Write's an item to the cache // don't use the logger inside here
protected static storeToCache ( $data, $key, array $tags = [], null $lifetime = null, boolean $force = false ) : boolean | void
$data
$key
$tags array
$lifetime null
$force boolean
return boolean | void

test() public static method

Get the last modified time for the requested cache entry
public static test ( string $key ) : integer | boolean
$key string Cache key
return integer | boolean Last modified time of cache entry if it is available, false otherwise

write() public static method

Write the stack to the cache
public static write ( ) : void
return void

Property Details

$_clearTagsOnShutdown protected_oe static_oe property

Items having tags which are in this array are cleared on shutdown \Pimcore::shutdown(); This is especially for the output-cache
protected static array $_clearTagsOnShutdown
return array

$blackHoleCache protected_oe static_oe property

protected static Zend_Cache_Core $blackHoleCache
return Zend_Cache_Core

$cachePrefix public_oe static_oe property

prefix which will be added to every item-key
public static string $cachePrefix
return string

$clearedTagsStack public_oe static_oe property

Contains the tags which were already cleared
public static array $clearedTagsStack
return array

$defaultLifetime public_oe static_oe property

public static null $defaultLifetime
return null

$enabled protected_oe static_oe property

protected static bool $enabled
return boolean

$forceImmediateWrite protected_oe static_oe property

if set to truq items are directly written into the cache, and do not get into the queue
protected static bool $forceImmediateWrite
return boolean

$ignoredTagsOnClear public_oe static_oe property

items having one of the tags in this store are not cleared when calling self::clearTags() or self::clearTag()
public static array $ignoredTagsOnClear
return array

$instance public_oe static_oe property

Instance of the used cache-implementation
public static Zend_Cache_Core|Zend_Cache_Frontend $instance
return Zend_Cache_Core | Zend_Cache_Frontend

$logger public_oe static_oe property

Contains the Logger, this is necessary because otherwise logging doesn't work in shutdown (missing reference)
public static Logger,pimcore $logger
return Logger

$maxWriteToCacheItems public_oe static_oe property

How many items should stored to the cache within one process
public static int $maxWriteToCacheItems
return integer

$saveStack public_oe static_oe property

Contains the items which should be written to the cache on shutdown. They are ordered respecting the priority
public static array $saveStack
return array

$writeLockTimestamp protected_oe static_oe property

contains the timestamp of the writeLockTime from the current process this is to recheck when removing the write lock (if the value is different -> higher) do not remove the lock because then another process has acquired a lock
protected static int $writeLockTimestamp
return integer