TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Cache\Backend\WincacheBackend Class Reference
Inheritance diagram for TYPO3\CMS\Core\Cache\Backend\WincacheBackend:
TYPO3\CMS\Core\Cache\Backend\AbstractBackend TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface

Public Member Functions

 __construct ($context, array $options=[])
 
 set ($entryIdentifier, $data, array $tags=[], $lifetime=null)
 
 get ($entryIdentifier)
 
 has ($entryIdentifier)
 
 remove ($entryIdentifier)
 
 findIdentifiersByTag ($tag)
 
 flush ()
 
 flushByTag ($tag)
 
 collectGarbage ()
 
- Public Member Functions inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 __construct ($context, array $options=[])
 
 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 setDefaultLifetime ($defaultLifetime)
 

Protected Member Functions

 findTagsByIdentifier ($identifier)
 
 addIdentifierToTags ($entryIdentifier, array $tags)
 
 removeIdentifierFromAllTags ($entryIdentifier)
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 calculateExpiryTime ($lifetime=null)
 

Protected Attributes

 $identifierPrefix
 
- Protected Attributes inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 $cache
 
 $cacheIdentifier
 
 $context
 
 $defaultLifetime = 3600
 

Additional Inherited Members

- Public Attributes inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
const DATETIME_EXPIRYTIME_UNLIMITED = '9999-12-31T23:59:59+0000'
 
const UNLIMITED_LIFETIME = 0
 

Detailed Description

A caching backend which stores cache entries by using wincache.

This backend uses the following types of keys:

  • tag_xxx xxx is tag name, value is array of associated identifiers identifier. This is "forward" tag index. It is mainly used for obtaining content by tag (get identifier by tag -> get content by identifier)
  • ident_xxx xxx is identifier, value is array of associated tags. This is "reverse" tag index. It provides quick access for all tags associated with this identifier and used when removing the identifier

Each key is prepended with a prefix. By default prefix consists from two parts separated by underscore character and ends in yet another underscore character:

  • "TYPO3"
  • MD5 of script path and filename and SAPI name This prefix makes sure that keys from the different installations do not conflict.

Definition at line 37 of file WincacheBackend.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::__construct (   $context,
array  $options = [] 
)

Constructs this backend

Parameters
string$contextFLOW3's application context
array$optionsConfiguration options
Exceptions

Definition at line 53 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\AbstractBackend\$context.

Member Function Documentation

◆ addIdentifierToTags()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::addIdentifierToTags (   $entryIdentifier,
array  $tags 
)
protected

Associates the identifier with the given tags

Parameters
string$entryIdentifier
array$tags
Returns
void

Definition at line 198 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\WincacheBackend\findIdentifiersByTag(), and TYPO3\CMS\Core\Cache\Backend\WincacheBackend\findTagsByIdentifier().

Referenced by TYPO3\CMS\Core\Cache\Backend\WincacheBackend\set().

◆ collectGarbage()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::collectGarbage ( )

Does nothing, as wincache does GC itself

Returns
void

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 260 of file WincacheBackend.php.

◆ findIdentifiersByTag()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::findIdentifiersByTag (   $tag)

Finds and returns all cache entry identifiers which are tagged by the specified tag.

Parameters
string$tagThe tag to search for
Returns
array An array with identifiers of all matching entries. An empty array if no entries matched

Implements TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface.

Definition at line 137 of file WincacheBackend.php.

Referenced by TYPO3\CMS\Core\Cache\Backend\WincacheBackend\addIdentifierToTags(), TYPO3\CMS\Core\Cache\Backend\WincacheBackend\flushByTag(), and TYPO3\CMS\Core\Cache\Backend\WincacheBackend\removeIdentifierFromAllTags().

◆ findTagsByIdentifier()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::findTagsByIdentifier (   $identifier)
protected

Finds all tags for the given identifier. This function uses reverse tag index to search for tags.

Parameters
string$identifierIdentifier to find tags by
Returns
array Array with tags

Definition at line 155 of file WincacheBackend.php.

Referenced by TYPO3\CMS\Core\Cache\Backend\WincacheBackend\addIdentifierToTags(), and TYPO3\CMS\Core\Cache\Backend\WincacheBackend\removeIdentifierFromAllTags().

◆ flush()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::flush ( )

Removes all cache entries of this cache

Exceptions

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 168 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\WincacheBackend\flushByTag().

◆ flushByTag()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::flushByTag (   $tag)

Removes all cache entries of this cache which are tagged by the specified tag.

Parameters
string$tagThe tag the entries must have
Returns
void

Implements TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface.

Definition at line 183 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\WincacheBackend\findIdentifiersByTag().

Referenced by TYPO3\CMS\Core\Cache\Backend\WincacheBackend\flush().

◆ get()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::get (   $entryIdentifier)

Loads data from the cache

Parameters
string$entryIdentifierAn identifier which describes the cache entry to load
Returns
mixed The cache entry's content as a string or FALSE if the cache entry could not be loaded

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 98 of file WincacheBackend.php.

◆ has()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::has (   $entryIdentifier)

Checks if a cache entry with the specified identifier exists

Parameters
string$entryIdentifierAn identifier specifying the cache entry
Returns
bool TRUE if such an entry exists, FALSE if not

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 111 of file WincacheBackend.php.

◆ remove()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::remove (   $entryIdentifier)

Removes all cache entries matching the specified identifier. Usually this only affects one entry but if - for what reason ever - old entries for the identifier still exist, they are removed as well.

Parameters
string$entryIdentifierSpecifies the cache entry to remove
Returns
bool TRUE if (at least) an entry could be removed or FALSE if no entry was found

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 124 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\WincacheBackend\removeIdentifierFromAllTags().

◆ removeIdentifierFromAllTags()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::removeIdentifierFromAllTags (   $entryIdentifier)
protected

Removes association of the identifier with the given tags

Parameters
string$entryIdentifier
Returns
void

Definition at line 230 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\WincacheBackend\findIdentifiersByTag(), and TYPO3\CMS\Core\Cache\Backend\WincacheBackend\findTagsByIdentifier().

Referenced by TYPO3\CMS\Core\Cache\Backend\WincacheBackend\remove(), and TYPO3\CMS\Core\Cache\Backend\WincacheBackend\set().

◆ set()

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::set (   $entryIdentifier,
  $data,
array  $tags = [],
  $lifetime = null 
)

Saves data in the cache

Parameters
string$entryIdentifierAn identifier for this specific cache entry
string$dataThe data to be stored
array$tagsTags to associate with this cache entry
int$lifetimeLifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
Returns
void
Exceptions

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 73 of file WincacheBackend.php.

References TYPO3\CMS\Core\Cache\Backend\AbstractBackend\$defaultLifetime, TYPO3\CMS\Core\Cache\Backend\WincacheBackend\addIdentifierToTags(), and TYPO3\CMS\Core\Cache\Backend\WincacheBackend\removeIdentifierFromAllTags().

Member Data Documentation

◆ $identifierPrefix

TYPO3\CMS\Core\Cache\Backend\WincacheBackend::$identifierPrefix
protected

Definition at line 44 of file WincacheBackend.php.