Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel cache get all items with tag

In Laravel you can place items in the Cache with a tag like:

Cache::tags('bans')->put($result->ip, $result->reason);

But I can't seem to find a way to get all items with a certain tag. Is it possible to retrieve all items with a certain tag?

Like:

Cache::tags('bans')->all(); 

Or something like that

like image 798
Matthijn Avatar asked Oct 13 '14 12:10

Matthijn


1 Answers

In 'yourKeyGoesHere' you can insert a string used as same as a like with a * or insert directly the exactly key.

$redis = Cache::getRedis();
$a_keys = $redis->keys("*yourKeyGoesHere*");
like image 147
nat_jea Avatar answered Oct 01 '22 13:10

nat_jea