perturbatio/wildcache is a Laravel package.
It currently has 2 GitHub stars and 2.111 downloads on Packagist (latest version v2.0.4).
Install it with composer require perturbatio/wildcache.
Discover more Laravel packages by perturbatio
or browse all Laravel packages to compare alternatives.
Last updated
Adds the ability to find or remove items in the Laravel cache by wildcard.
Using WildCache, you can store items using a dot.notation syntax, then retrieve the item
matching to get or remove all items matching a pattern.
/** @var \Perturbatio\WildCache\WildCache $wildCache */
$wildCache = app('wildcache');
// use the WildCache to store the item with a dot separated key
$wildCache->put('test.WildCache.itemA', 9999, now()->addMinutes(10));
$wildCache->put('test.WildCache.itemB', 8888, now()->addMinutes(10));
The get method always returns a collection of any items that match the pattern, or the default value passed in
(defaults to null)
/** @var \Perturbatio\WildCache\WildCache $wildCache */
$wildCache = app('wildcache');
// returns the first item that has a key prefixed with `test.WildCache.`
echo $wildCache->get('test.WildCache.*')->first();
/** @var \Perturbatio\WildCache\WildCache $wildCache */
$wildCache = app('wildcache');
echo $wildCache->get('some.key', 'default_value')->first();
/** @var \Perturbatio\WildCache\WildCache $wildCache */
$wildCache = app('wildcache');
// use the WildCache to store the item with a dot separated key
$wildCache->put('test.WildCache.itemA', 9999, now()->addMinutes(10));
$wildCache->put('test.WildCache.itemB', 8888, now()->addMinutes(10));
// retrieve the first that matches the key
echo $wildCache->get('test.WildCache.*')->first(); // 9999
echo $wildCache->get('test.WildCache.*')->get('wildcache.test.itemB');