Hey,
I’m using \Yii::$app->userCache;
to store calculated results in memcache.
The keys of the cache entry are composed of the following parts:
1.) a prefix, that stands for the class of feature or action, like counts
, userdata
…
and
2.) a value-suffix for the keys, like comments
, posts
, …
So I have cache keys, like counts_comments
or counts_posts
.
Some of the value-suffixes are very dynamically, like an hash of serialized key-array of all often needed posts, where the cache-key looks like this: counts_4b3da834d3e1a
In some situations, I need to delete all cache entries starting with the same prefix.
I need something like this:
$cache = \Yii::$app->userCache; $cache->delete('counts_*');
Looking at the documentation:
I found the following information about the $key in delete($key);
:
This can be a simple string or a complex data structure consisting of factors representing the key.
What they mean with complex data structure
and can I fulfill my requirement with it?
Unfortunately I am missing a code example here.