CacheManager
extends CacheLib
in package
Cache
Tags
Table of Contents
Constants
- CACHE_DIRECTORY_OFFSET_ESI = 'esi/'
- ESI cache directory offset
- CACHE_DIRECTORY_OFFSET_PAGE = 'page/'
- Page cache directory offset
- CACHE_ENGINE_APC = 'apc'
- Alternative PHP Cache extension
- CACHE_ENGINE_MEMCACHE = 'memcache'
- memcache extension
- CACHE_ENGINE_MEMCACHED = 'memcached'
- memcache(d) extension
- CACHE_ENGINE_OFF = 'off'
- cache off
- CACHE_ENGINE_XCACHE = 'xcache'
- xcache extension
- CACHE_ENGINE_ZEND_OPCACHE = 'zendopcache'
- zend opcache extension
- LOCALE_CACHE_FILE_NAME = 'Locale.dat'
- File name for page cache locale data
Properties
- $arrSettings : mixed
- $objTpl : mixed
- $strCachePath : mixed
- $arrPageContent : array<string|int, mixed>
- Page info (url, locale, ...)
- $cacheIncrement : int
- Number added to $cachePrefix to allow "invalidating" the cache
- $cachePrefix : string
- Prefix to be used to identify cache entries in shared caching environments.
- $doctrineCacheEngine : AbstractCache
- $dynFuncs : array<string|int, mixed>
- Dynamic ESI variable callbacks
- $dynVars : array<string|int, mixed>
- Dynamic ESI variable callbacks
- $intCacingTime : int
- $jsonData : JsonData
- $memcache : mixed
- $memcached : mixed
- $opCacheEngine : mixed
- $opCacheEngines : array<string|int, mixed>
- Used op cache engines
- $ssiProxy : ReverseProxyProxy
- $userCacheEngine : mixed
- $userCacheEngines : type
- Used user cache engines
- $objSettings : mixed
Methods
- __construct() : mixed
- PHP5 constructor
- _deleteAllFiles() : mixed
- Delete all cached file's of the cache system
- CacheManager() : mixed
- Constructor
- clearCache() : mixed
- Flush all cache instances
- clearReverseProxyCache() : mixed
- Drops a cache page on reverse proxy cache
- clearSsiCache() : mixed
- Drops all cached ESI/SSI elements
- clearSsiCachePage() : mixed
- Drops the ESI cache for a specific call
- clearUserBasedEsiCache() : mixed
- Clear user based ESI cache
- clearUserBasedPageCache() : mixed
- Clear user based page cache
- deactivateNotUsedOpCaches() : mixed
- deleteComponentFiles() : mixed
- Delete all cached files for a component from cache-folder
- deleteNonPagePageCache() : mixed
- Drops all page cache files that do not belong to a page Those are cached header redirects
- deleteSingleFile() : mixed
- Delete all specific file from cache-folder
- forceClearCache() : mixed
- Calls the related Clear Function from Lib and sets an OK-Message
- getAllOpCacheEngines() : mixed
- getAllUserCacheEngines() : mixed
- getCacheFileNameFromUrl() : string
- Gets the local cache file name for an URL
- getCacheFileNameSearchPartsFromUrl() : array<string|int, mixed>
- Returns the validated file search parts of the URL
- getDoctrineCacheDriver() : AbstractCache
- Detects the correct doctrine cache driver for the user caching engine in use
- getEsiContent() : string
- Returns the ESI/SSI content for a (json)data call
- getMemcache() : mixed
- getMemcached() : Memcache
- getOpCacheActive() : mixed
- getOpCacheEngine() : mixed
- getRandomizedEsiContent() : string
- Each entry of $esiContentInfos consists of an array like: array( <adapterName>, <adapterMethod>, <params>, )
- getSettings() : array<string|int, mixed>
- Creates an array containing all important cache-settings
- getSsiProxy() : ReverseProxy
- Returns the current SSI proxy
- getUserCacheActive() : mixed
- getUserCacheEngine() : mixed
- initEsiDynVars() : mixed
- Loads dynamic ESI variables and functions
- internalEsiParsing() : string
- Parses ESI directives internally if configured to do so
- parseEsiVars() : string
- Parses the dynamic ESI variables and functions in the given content
- setCachedLocaleData() : mixed
- Sets the cached locale data
- setCachePrefix() : mixed
- Overwrite the automatically set CachePrefix
- showSettings() : mixed
- Show settings of the module
- updateSettings() : mixed
- Update settings and write them to the database
- checkCacheDir() : mixed
- Makes sure that the cache directory exists and is writable
- clearMemcached() : mixed
- Clears all Memcacheddata related to this Domain if Memcache is installed
- getActivatedCacheEngines() : mixed
- getApiResponseForUrl() : string
- Returns the content of the API response for an API URL This gets data internally and does not do a HTTP request!
- getCachedLocaleData() : array<string|int, mixed>
- Returns the cached locale data
- getCachePrefix() : string
- Retunrns the CachePrefix related to this Domain
- getDomainsAndPorts() : array<string|int, mixed>
- Returns all domains and ports this instance of cloudrexx can be reached at
- getMemcacheConfiguration() : mixed
- getMemcachedConfiguration() : mixed
- getReverseProxyConfiguration() : array<string|int, mixed>
- Gets the configuration value for reverse proxy
- getSsiProcessorConfiguration() : array<string|int, mixed>
- Gets the configuration value for external ESI/SSI processor
- getUrlFromApi() : Url
- Wrapper for \Cx\Core\Routing\Url::fromApi() This ensures correct param order
- initOPCaching() : mixed
- initRequestInfo() : mixed
- Initializes basic request info (url, locale, ...)
- initUserCaching() : mixed
- isActive() : mixed
- isConfigured() : mixed
- isInstalled() : mixed
- parseMemcachedSettings() : mixed
- parseMemcacheSettings() : mixed
- parseReverseProxySettings() : mixed
- Parses reverse proxy settings to current template
- parseSsiProcessorSettings() : mixed
- Parses reverse ESI/SSI processor settings to current template
- selectBestLanguageFromRequest() : array<string|int, mixed>
- Returns the necessary data to later identify the matching locale
- setCachePath() : mixed
- Sets the cache path
- clearApc() : mixed
- Clears APC cache if APC is installed
- clearMemcache() : mixed
- Clears all Memcachedata related to this Domain if Memcache is installed
- clearXcache() : mixed
- Clears XCache if configured. Configuration is needed to clear.
- clearZendOpCache() : mixed
- Clears Zend OPCache if installed
- parseOPCacheEngines() : mixed
- parseUserCacheEngines() : mixed
Constants
CACHE_DIRECTORY_OFFSET_ESI
ESI cache directory offset
public
mixed
CACHE_DIRECTORY_OFFSET_ESI
= 'esi/'
CACHE_DIRECTORY_OFFSET_PAGE
Page cache directory offset
public
mixed
CACHE_DIRECTORY_OFFSET_PAGE
= 'page/'
CACHE_ENGINE_APC
Alternative PHP Cache extension
public
mixed
CACHE_ENGINE_APC
= 'apc'
CACHE_ENGINE_MEMCACHE
memcache extension
public
mixed
CACHE_ENGINE_MEMCACHE
= 'memcache'
CACHE_ENGINE_MEMCACHED
memcache(d) extension
public
mixed
CACHE_ENGINE_MEMCACHED
= 'memcached'
CACHE_ENGINE_OFF
cache off
public
mixed
CACHE_ENGINE_OFF
= 'off'
CACHE_ENGINE_XCACHE
xcache extension
public
mixed
CACHE_ENGINE_XCACHE
= 'xcache'
CACHE_ENGINE_ZEND_OPCACHE
zend opcache extension
public
mixed
CACHE_ENGINE_ZEND_OPCACHE
= 'zendopcache'
LOCALE_CACHE_FILE_NAME
File name for page cache locale data
public
mixed
LOCALE_CACHE_FILE_NAME
= 'Locale.dat'
Properties
$arrSettings
public
mixed
$arrSettings
= array()
$objTpl
public
mixed
$objTpl
$strCachePath
public
mixed
$strCachePath
$arrPageContent
Page info (url, locale, ...)
protected
array<string|int, mixed>
$arrPageContent
= array()
$cacheIncrement
Number added to $cachePrefix to allow "invalidating" the cache
protected
int
$cacheIncrement
= 1
$cachePrefix
Prefix to be used to identify cache entries in shared caching environments.
protected
string
$cachePrefix
$doctrineCacheEngine
protected
AbstractCache
$doctrineCacheEngine
= null
doctrine cache engine for the active user cache engine
$dynFuncs
Dynamic ESI variable callbacks
protected
array<string|int, mixed>
$dynFuncs
= array()
$dynVars
Dynamic ESI variable callbacks
protected
array<string|int, mixed>
$dynVars
= array()
$intCacingTime
protected
int
$intCacingTime
Cache lease time in seconds
$jsonData
protected
JsonData
$jsonData
= null
$memcache
protected
mixed
$memcache
= null
$memcached
protected
mixed
$memcached
= null
$opCacheEngine
protected
mixed
$opCacheEngine
= null
$opCacheEngines
Used op cache engines
protected
array<string|int, mixed>
$opCacheEngines
= array()
Cache engine names, empty for none
$ssiProxy
protected
ReverseProxyProxy
$ssiProxy
SSI proxy
$userCacheEngine
protected
mixed
$userCacheEngine
= null
$userCacheEngines
Used user cache engines
protected
type
$userCacheEngines
= array()
array Cache engine names, empty for none
$objSettings
private
mixed
$objSettings
Methods
__construct()
PHP5 constructor
public
__construct() : mixed
Tags
_deleteAllFiles()
Delete all cached file's of the cache system
public
_deleteAllFiles([mixed $cacheEngine = null ]) : mixed
Parameters
- $cacheEngine : mixed = null
CacheManager()
Constructor
public
CacheManager() : mixed
clearCache()
Flush all cache instances
public
clearCache([string $cacheEngine = null ][, bool $includingEsi = true ]) : mixed
Parameters
- $cacheEngine : string = null
-
See CACHE_ENGINE_* constants
- $includingEsi : bool = true
-
(optional) Whether to drop ESI cache
Tags
clearReverseProxyCache()
Drops a cache page on reverse proxy cache
public
clearReverseProxyCache(mixed $urlPattern) : mixed
Parameters
- $urlPattern : mixed
clearSsiCache()
Drops all cached ESI/SSI elements
public
clearSsiCache([mixed $urlPattern = '' ]) : mixed
Parameters
- $urlPattern : mixed = ''
clearSsiCachePage()
Drops the ESI cache for a specific call
public
clearSsiCachePage(string $adapterName, string $adapterMethod[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $adapterName : string
-
(Json)Data adapter name
- $adapterMethod : string
-
(Json)Data method name
- $params : array<string|int, mixed> = array()
-
(optional) params for (Json)Data method call
Tags
clearUserBasedEsiCache()
Clear user based ESI cache
public
clearUserBasedEsiCache([string $sessionId = '' ]) : mixed
If argument $sessionId is set, then only the cache of the user (identified by sessionid $sessionId) will be flushed. Otherwise (if $sessionId is not set), the complete user based cache is flushed.
Parameters
- $sessionId : string = ''
-
The session ID of the user of whom to clear the esi cache from. If not set, then all used based cach is flusehd.
clearUserBasedPageCache()
Clear user based page cache
public
clearUserBasedPageCache([string $sessionId = '' ]) : mixed
If argument $sessionId is set, then only the cache of the user (identified by sessionid $sessionId) will be flushed. Otherwise (if $sessionId is not set), the complete user based cache is flushed.
Parameters
- $sessionId : string = ''
-
The session ID of the user of whom to clear the page cache from. If not set, then all used based cach is flusehd.
deactivateNotUsedOpCaches()
public
deactivateNotUsedOpCaches() : mixed
deleteComponentFiles()
Delete all cached files for a component from cache-folder
public
deleteComponentFiles(mixed $componentName) : mixed
Parameters
- $componentName : mixed
deleteNonPagePageCache()
Drops all page cache files that do not belong to a page Those are cached header redirects
public
deleteNonPagePageCache() : mixed
deleteSingleFile()
Delete all specific file from cache-folder
public
deleteSingleFile(mixed $intPageId) : mixed
Parameters
- $intPageId : mixed
forceClearCache()
Calls the related Clear Function from Lib and sets an OK-Message
public
forceClearCache([string $cacheEngine = null ]) : mixed
Parameters
- $cacheEngine : string = null
Tags
getAllOpCacheEngines()
public
getAllOpCacheEngines() : mixed
getAllUserCacheEngines()
public
getAllUserCacheEngines() : mixed
getCacheFileNameFromUrl()
Gets the local cache file name for an URL
public
getCacheFileNameFromUrl(string $url, string $originalUrl[, bool $withCacheInfoPart = true ]) : string
Parameters
- $url : string
-
URL to get file name for
- $originalUrl : string
-
URL of the page that ESI is parsed for
- $withCacheInfoPart : bool = true
-
(optional) Adds info part (default true)
Return values
string —File name (without path)
getCacheFileNameSearchPartsFromUrl()
Returns the validated file search parts of the URL
public
getCacheFileNameSearchPartsFromUrl(string $url, string $originalUrl) : array<string|int, mixed>
Parameters
- $url : string
-
URL to parse
- $originalUrl : string
-
URL of the page that ESI is parsed for
Return values
array<string|int, mixed> —<fileNamePrefix>=><parsedValue> type array
getDoctrineCacheDriver()
Detects the correct doctrine cache driver for the user caching engine in use
public
getDoctrineCacheDriver() : AbstractCache
Return values
AbstractCache —The doctrine cache driver object
getEsiContent()
Returns the ESI/SSI content for a (json)data call
public
getEsiContent(string $adapterName, string $adapterMethod[, array<string|int, mixed> $params = array() ]) : string
Parameters
- $adapterName : string
-
(Json)Data adapter name
- $adapterMethod : string
-
(Json)Data method name
- $params : array<string|int, mixed> = array()
-
(optional) params for (Json)Data method call
Return values
string —ESI/SSI directives to put into HTML code
getMemcache()
public
getMemcache() : mixed
getMemcached()
public
getMemcached() : Memcache
Return values
Memcache —The memcached object
getOpCacheActive()
public
getOpCacheActive() : mixed
getOpCacheEngine()
public
getOpCacheEngine() : mixed
getRandomizedEsiContent()
Each entry of $esiContentInfos consists of an array like: array( <adapterName>, <adapterMethod>, <params>, )
public
getRandomizedEsiContent(array<string|int, mixed> $esiContentInfos[, int $count = 1 ]) : string
Parameters
- $esiContentInfos : array<string|int, mixed>
-
List of ESI content info arrays
- $count : int = 1
-
(optional) Number of unique random entries to parse
Return values
string —ESI randomized include code
getSettings()
Creates an array containing all important cache-settings
public
getSettings() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —$arrSettings
getSsiProxy()
Returns the current SSI proxy
public
getSsiProxy() : ReverseProxy
Return values
ReverseProxy —SSI proxy
getUserCacheActive()
public
getUserCacheActive() : mixed
getUserCacheEngine()
public
getUserCacheEngine() : mixed
initEsiDynVars()
Loads dynamic ESI variables and functions
public
initEsiDynVars() : mixed
internalEsiParsing()
Parses ESI directives internally if configured to do so
public
internalEsiParsing(string $htmlCode[, mixed $cxNotYetInitialized = false ]) : string
Parameters
- $htmlCode : string
-
HTML code to replace ESI directives in
- $cxNotYetInitialized : mixed = false
Return values
string —Parsed HTML code
parseEsiVars()
Parses the dynamic ESI variables and functions in the given content
public
parseEsiVars(string $content) : string
Parameters
- $content : string
-
Content to parse
Return values
string —Parsed content
setCachedLocaleData()
Sets the cached locale data
public
setCachedLocaleData(Cx $cx) : mixed
Default locale and the following hashtables are cached: <localeCode> to <localeId> <localeCountryCode> to <localeCodes>
Parameters
- $cx : Cx
-
Cx instance
setCachePrefix()
Overwrite the automatically set CachePrefix
public
setCachePrefix([ $prefix = '' ]) : mixed
Parameters
showSettings()
Show settings of the module
public
showSettings() : mixed
Tags
updateSettings()
Update settings and write them to the database
public
updateSettings() : mixed
Tags
checkCacheDir()
Makes sure that the cache directory exists and is writable
protected
checkCacheDir(Cx $cx) : mixed
Parameters
- $cx : Cx
-
The contrexx instance
clearMemcached()
Clears all Memcacheddata related to this Domain if Memcache is installed
protected
clearMemcached() : mixed
getActivatedCacheEngines()
protected
getActivatedCacheEngines() : mixed
getApiResponseForUrl()
Returns the content of the API response for an API URL This gets data internally and does not do a HTTP request!
protected
getApiResponseForUrl(string $url[, Response|null &$responseObj = null ]) : string
Parameters
- $url : string
-
API URL
- $responseObj : Response|null = null
-
(optional) Response object
Tags
Return values
string —API content or empty string
getCachedLocaleData()
Returns the cached locale data
protected
getCachedLocaleData() : array<string|int, mixed>
Default locale and the following hashtables are cached: <localeCode> to <localeId> <localeCountryCode> to <localeCodes>
Return values
array<string|int, mixed> —Cached locale data or empty array
getCachePrefix()
Retunrns the CachePrefix related to this Domain
protected
getCachePrefix([bool $withoutIncrement = false ]) : string
Parameters
- $withoutIncrement : bool = false
-
(optional) If set to true returns the prefix without the increment
Tags
Return values
string —CachePrefix
getDomainsAndPorts()
Returns all domains and ports this instance of cloudrexx can be reached at
protected
getDomainsAndPorts() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of domains and ports (array(array(0=>{domain}, 1=>{port})))
getMemcacheConfiguration()
protected
getMemcacheConfiguration() : mixed
getMemcachedConfiguration()
protected
getMemcachedConfiguration() : mixed
getReverseProxyConfiguration()
Gets the configuration value for reverse proxy
protected
getReverseProxyConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed> —'ip' and 'port' of reverse proxy
getSsiProcessorConfiguration()
Gets the configuration value for external ESI/SSI processor
protected
getSsiProcessorConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed> —'ip' and 'port' of external ESI/SSI processor
getUrlFromApi()
Wrapper for \Cx\Core\Routing\Url::fromApi() This ensures correct param order
protected
getUrlFromApi(string $adapterName, string $adapterMethod, array<string|int, mixed> $params) : Url
Parameters
- $adapterName : string
-
(Json)Data adapter name
- $adapterMethod : string
-
(Json)Data method name
- $params : array<string|int, mixed>
-
(optional) params for (Json)Data method call
Return values
Url —URL for (Json)Data call
initOPCaching()
protected
initOPCaching() : mixed
initRequestInfo()
Initializes basic request info (url, locale, ...)
protected
initRequestInfo() : mixed
initUserCaching()
protected
initUserCaching() : mixed
isActive()
protected
isActive(mixed $cacheEngine) : mixed
Parameters
- $cacheEngine : mixed
isConfigured()
protected
isConfigured(mixed $cacheEngine[, mixed $user = false ]) : mixed
Parameters
- $cacheEngine : mixed
- $user : mixed = false
isInstalled()
protected
isInstalled(mixed $cacheEngine) : mixed
Parameters
- $cacheEngine : mixed
parseMemcachedSettings()
protected
parseMemcachedSettings() : mixed
parseMemcacheSettings()
protected
parseMemcacheSettings() : mixed
parseReverseProxySettings()
Parses reverse proxy settings to current template
protected
parseReverseProxySettings() : mixed
parseSsiProcessorSettings()
Parses reverse ESI/SSI processor settings to current template
protected
parseSsiProcessorSettings() : mixed
selectBestLanguageFromRequest()
Returns the necessary data to later identify the matching locale
protected
selectBestLanguageFromRequest(Cx $cx) : array<string|int, mixed>
This method does not use database or cached database data
Parameters
- $cx : Cx
-
Cx instance
Return values
array<string|int, mixed> —Locale info
setCachePath()
Sets the cache path
protected
setCachePath() : mixed
clearApc()
Clears APC cache if APC is installed
private
clearApc() : mixed
clearMemcache()
Clears all Memcachedata related to this Domain if Memcache is installed
private
clearMemcache() : mixed
clearXcache()
Clears XCache if configured. Configuration is needed to clear.
private
clearXcache() : mixed
clearZendOpCache()
Clears Zend OPCache if installed
private
clearZendOpCache() : mixed
parseOPCacheEngines()
private
parseOPCacheEngines() : mixed
parseUserCacheEngines()
private
parseUserCacheEngines() : mixed