Drupal 8  8.0.2
CacheTagsChecksumInterface Interface Reference
Inheritance diagram for CacheTagsChecksumInterface:

Public Member Functions

 getCurrentChecksum (array $tags)
 isValid ($checksum, array $tags)
 reset ()

Detailed Description

Provides checksums for cache tag invalidations.

Cache backends can use this to check if any cache tag invalidations happened for a stored cache item.

To do so, they can inject the cache_tags.invalidator.checksum service, and when a cache item is written, store cache tags together with the current checksum, calculated by getCurrentChecksum(). When a cache item is fetched, the checksum can be validated with isValid(). The service will return FALSE if any of those cache tags were invalidated in the meantime.

Member Function Documentation

getCurrentChecksum ( array  $tags)

Returns the sum total of validations for a given set of tags.

Called by a backend when storing a cache item.

string[]$tags Array of cache tags.
string Cache tag invalidations checksum.

Implemented in DatabaseCacheTagsChecksum.

isValid (   $checksum,
array  $tags 

Returns whether the checksum is valid for the given cache tags.

Used when retrieving a cache item in a cache backend, to verify that no cache tag based invalidation happened.

int$checksumThe checksum that was stored together with the cache item.
string[]$tags The cache tags that were stored together with the cache item.
bool FALSE if cache tag invalidations happened for the passed in tags since the cache item was stored, TRUE otherwise.

Implemented in DatabaseCacheTagsChecksum.

reset ( )

Reset statically cached tags.

This is only used by tests.

Implemented in DatabaseCacheTagsChecksum.

The documentation for this interface was generated from the following file: