TYPO3
7.6
|
Public Member Functions | |
__construct ($context, array $options=array()) | |
initializeObject () | |
setHostname ($hostname) | |
setPort ($port) | |
setDatabase ($database) | |
setPassword ($password) | |
setCompression ($compression) | |
setCompressionLevel ($compressionLevel) | |
set ($entryIdentifier, $data, array $tags=array(), $lifetime=null) | |
get ($entryIdentifier) | |
has ($entryIdentifier) | |
remove ($entryIdentifier) | |
findIdentifiersByTag ($tag) | |
flush () | |
flushByTag ($tag) | |
collectGarbage () | |
Public Member Functions inherited from AbstractBackend | |
__construct ($context, array $options=array()) | |
setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache) | |
setDefaultLifetime ($defaultLifetime) | |
Public Attributes | |
const | FAKED_UNLIMITED_LIFETIME = 31536000 |
const | IDENTIFIER_DATA_PREFIX = 'identData:' |
const | IDENTIFIER_TAGS_PREFIX = 'identTags:' |
const | TAG_IDENTIFIERS_PREFIX = 'tagIdents:' |
Public Attributes inherited from AbstractBackend | |
const | DATETIME_EXPIRYTIME_UNLIMITED = '9999-12-31T23:59:59+0000' |
const | UNLIMITED_LIFETIME = 0 |
Protected Member Functions | |
removeIdentifierEntriesAndRelations (array $identifiers, array $tags) | |
canBeUsedInStringContext ($variable) | |
Protected Member Functions inherited from AbstractBackend | |
calculateExpiryTime ($lifetime=null) | |
Protected Attributes | |
$redis | |
$connected = false | |
$hostname = '127.0.0.1' | |
$port = 6379 | |
$database = 0 | |
$password = '' | |
$compression = false | |
$compressionLevel = -1 | |
Protected Attributes inherited from AbstractBackend | |
$cache | |
$cacheIdentifier | |
$context | |
$defaultLifetime = 3600 | |
A caching backend which stores cache entries by using Redis with phpredis PHP module. Redis is a noSQL database with very good scaling characteristics in proportion to the amount of entries and data size.
Definition at line 28 of file RedisBackend.php.
__construct | ( | $context, | |
array | $options = array() |
||
) |
Construct this backend
string | $context | FLOW3's application context |
array | $options | Configuration options |
\TYPO3\CMS\Core\Cache\Exception | if php redis module is not loaded |
Definition at line 125 of file RedisBackend.php.
References AbstractBackend\$context.
|
protected |
Helper method to catch invalid identifiers and tags
mixed | $variable | Variable to be checked |
Definition at line 528 of file RedisBackend.php.
Referenced by RedisBackend\findIdentifiersByTag(), RedisBackend\flushByTag(), RedisBackend\get(), RedisBackend\has(), RedisBackend\remove(), and RedisBackend\set().
collectGarbage | ( | ) |
With the current internal structure, only the identifier to data entries have a redis internal lifetime. If an entry expires, attached identifier to tags and tag to identifiers entries will be left over. This methods finds those entries and cleans them up.
Scales O(n*m) with number of cache entries (n) and number of tags (m)
Implements BackendInterface.
Definition at line 463 of file RedisBackend.php.
findIdentifiersByTag | ( | $tag | ) |
Finds and returns all cache entry identifiers which are tagged by the specified tag.
Scales O(1) with number of cache entries Scales O(n) with number of tag entries
string | $tag | The tag to search for |
\InvalidArgumentException | if tag is not a string |
Implements TaggableBackendInterface.
Definition at line 401 of file RedisBackend.php.
References RedisBackend\canBeUsedInStringContext().
flush | ( | ) |
Removes all cache entries of this cache.
Scales O(1) with number of cache entries
Implements BackendInterface.
Definition at line 421 of file RedisBackend.php.
flushByTag | ( | $tag | ) |
Removes all cache entries of this cache which are tagged with the specified tag.
Scales O(1) with number of cache entries Scales O(n^2) with number of tag entries
string | $tag | Tag the entries must have |
\InvalidArgumentException | if identifier is not a string |
Implements TaggableBackendInterface.
Definition at line 439 of file RedisBackend.php.
References RedisBackend\canBeUsedInStringContext(), and RedisBackend\removeIdentifierEntriesAndRelations().
get | ( | $entryIdentifier | ) |
Loads data from the cache.
Scales O(1) with number of cache entries
string | $entryIdentifier | An identifier which describes the cache entry to load |
\InvalidArgumentException | if identifier is not a string |
Implements BackendInterface.
Definition at line 324 of file RedisBackend.php.
References RedisBackend\canBeUsedInStringContext().
has | ( | $entryIdentifier | ) |
Checks if a cache entry with the specified identifier exists.
Scales O(1) with number of cache entries
string | $entryIdentifier | Identifier specifying the cache entry |
\InvalidArgumentException | if identifier is not a string |
Implements BackendInterface.
Definition at line 349 of file RedisBackend.php.
References RedisBackend\canBeUsedInStringContext().
initializeObject | ( | ) |
Initializes the redis backend
\TYPO3\CMS\Core\Cache\Exception | if access to redis with password is denied or if database selection fails |
Definition at line 139 of file RedisBackend.php.
References port, and GeneralUtility\SYSLOG_SEVERITY_ERROR.
remove | ( | $entryIdentifier | ) |
Removes all cache entries matching the specified identifier.
Scales O(1) with number of cache entries Scales O(n) with number of tags
string | $entryIdentifier | Specifies the cache entry to remove |
\InvalidArgumentException | if identifier is not a string |
Implements BackendInterface.
Definition at line 368 of file RedisBackend.php.
References RedisBackend\canBeUsedInStringContext().
|
protected |
Helper method for flushByTag() Gets list of identifiers and tags and removes all relations of those tags
Scales O(1) with number of cache entries Scales O(n^2) with number of tags
array | $identifiers | List of identifiers to remove |
array | $tags | List of tags to be handled |
Definition at line 492 of file RedisBackend.php.
References StringUtility\getUniqueId().
Referenced by RedisBackend\flushByTag().
set | ( | $entryIdentifier, | |
$data, | |||
array | $tags = array() , |
||
$lifetime = null |
|||
) |
Save data in the cache
Scales O(1) with number of cache entries Scales O(n) with number of tags
string | $entryIdentifier | Identifier for this specific cache entry |
string | $data | Data to be stored |
array | $tags | Tags to associate with this cache entry |
int | $lifetime | Lifetime of this cache entry in seconds. If NULL is specified, default lifetime is used. "0" means unlimited lifetime. |
\InvalidArgumentException | if identifier is not valid |
\TYPO3\CMS\Core\Cache\Exception\InvalidDataException | if data is not a string |
Implements BackendInterface.
Definition at line 271 of file RedisBackend.php.
References RedisBackend\canBeUsedInStringContext().
setCompression | ( | $compression | ) |
Enable data compression
bool | $compression | TRUE to enable compression |
\InvalidArgumentException | if compression parameter is not of type boolean |
Definition at line 226 of file RedisBackend.php.
References RedisBackend\$compression.
setCompressionLevel | ( | $compressionLevel | ) |
Set data compression level. If compression is enabled and this is not set, gzcompress default level will be used.
int | $compressionLevel | -1 to 9: Compression level |
\InvalidArgumentException | if compressionLevel parameter is not within allowed bounds |
Definition at line 244 of file RedisBackend.php.
References RedisBackend\$compressionLevel.
setDatabase | ( | $database | ) |
Setter for database number
int | $database | Database |
\InvalidArgumentException | if database number is not valid |
Definition at line 195 of file RedisBackend.php.
References RedisBackend\$database.
setHostname | ( | $hostname | ) |
Setter for server hostname
string | $hostname | Hostname |
Definition at line 170 of file RedisBackend.php.
References RedisBackend\$hostname.
setPassword | ( | $password | ) |
Setter for authentication password
string | $password | Password |
Definition at line 213 of file RedisBackend.php.
References RedisBackend\$password.
setPort | ( | $port | ) |
Setter for server port
int | $port | Port |
Definition at line 182 of file RedisBackend.php.
References RedisBackend\$port, and port.
|
protected |
Definition at line 109 of file RedisBackend.php.
Referenced by RedisBackend\setCompression().
|
protected |
Definition at line 116 of file RedisBackend.php.
Referenced by RedisBackend\setCompressionLevel().
|
protected |
Definition at line 74 of file RedisBackend.php.
|
protected |
Definition at line 95 of file RedisBackend.php.
Referenced by RedisBackend\setDatabase().
|
protected |
Definition at line 81 of file RedisBackend.php.
Referenced by RedisBackend\setHostname().
|
protected |
Definition at line 102 of file RedisBackend.php.
Referenced by RedisBackend\setPassword().
|
protected |
Definition at line 88 of file RedisBackend.php.
Referenced by RedisBackend\setPort().
|
protected |
Definition at line 67 of file RedisBackend.php.
const FAKED_UNLIMITED_LIFETIME = 31536000 |
Definition at line 43 of file RedisBackend.php.
const IDENTIFIER_DATA_PREFIX = 'identData:' |
Definition at line 49 of file RedisBackend.php.
const IDENTIFIER_TAGS_PREFIX = 'identTags:' |
Definition at line 55 of file RedisBackend.php.
const TAG_IDENTIFIERS_PREFIX = 'tagIdents:' |
Definition at line 61 of file RedisBackend.php.