PHP Class yii\caching\TagDependency

By calling TagDependency::invalidate, you can invalidate all cached data items that are associated with the specified tag name(s).
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\caching\Dependency
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$tags a list of tag names for this dependency. For a single tag, you may specify it as a string.

Public Methods

Method Description
invalidate ( Cache $cache, string | array $tags ) Invalidates all of the cached data items that are associated with any of the specified [[tags]].
isChanged ( $cache )

Protected Methods

Method Description
generateDependencyData ( Cache $cache ) : mixed Generates the data needed to determine if dependency has been changed.
getTimestamps ( Cache $cache, string[] $tags ) : array Returns the timestamps for the specified tags.
touchKeys ( Cache $cache, string[] $keys ) : array Generates the timestamp for the specified cache keys.

Method Details

generateDependencyData() protected method

This method does nothing in this class.
protected generateDependencyData ( Cache $cache ) : mixed
$cache Cache the cache component that is currently evaluating this dependency
return mixed the data needed to determine if dependency has been changed.

getTimestamps() protected method

Returns the timestamps for the specified tags.
protected getTimestamps ( Cache $cache, string[] $tags ) : array
$cache Cache
$tags string[]
return array the timestamps indexed by the specified tags.

invalidate() public static method

Invalidates all of the cached data items that are associated with any of the specified [[tags]].
public static invalidate ( Cache $cache, string | array $tags )
$cache Cache the cache component that caches the data items
$tags string | array

isChanged() public method

public isChanged ( $cache )

touchKeys() protected static method

Generates the timestamp for the specified cache keys.
protected static touchKeys ( Cache $cache, string[] $keys ) : array
$cache Cache
$keys string[]
return array the timestamp indexed by cache keys

Property Details

$tags public property

a list of tag names for this dependency. For a single tag, you may specify it as a string.
public $tags