New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

perturbatio/wildcache

2,111 2
Install
composer require perturbatio/wildcache
Latest Version:v2.0.4
Laravel:6 – 9
Older releases:5
License:MIT
Last Updated:Aug 29, 2022
Links: GitHub  ·  Packagist
Maintainer: Perturbatio

WildCache

CircleCI Latest Stable Version Latest Unstable Version License Total Downloads

Adds the ability to find or remove items in the Laravel cache by wildcard.

Usage

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.

Methods

Put - Write a value to cache

/** @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));

Get

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');

Related Packages

bunkuris/has-cache

HasCache trait for Laravel models with cache key managers

3,596 0
silber/page-cache

Caches responses as static files on disk for lightning fast page loads.

526,472 1,262
laracasts/matryoshka

Russian Doll Caching for Laravel.

60,992 237
geekcache/geekcache

A wrapper for Memcached with tags, soft invalidation, memoization, and regenerat...

38,888 6
mitydigital/statamic-scheduled-cache-invalidator

A command to help invalidate the cache when scheduled Statamic entries are due t...

32,774 3

Version History

Version Released Laravel License
v2.0.4 ^6|^7|^8|^9 MIT
v2.0.3 ^6|^7|^8 MIT
v2.0.2 ^6|^7|^8 MIT
v2.0.1 ^6|^7|^8 MIT
v2.0.0 ^6|^7|^8 MIT