Download the PHP package mis3085/laravel-cache-label without Composer
On this page you can find all versions of the php package mis3085/laravel-cache-label. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mis3085/laravel-cache-label
More information about mis3085/laravel-cache-label
Files in mis3085/laravel-cache-label
Package laravel-cache-label
Short Description An alternative method of categorizing cached items in Laravel
License MIT
Homepage https://github.com/mis3085/laravel-cache-label
Informations about the package laravel-cache-label
An alternative method of categorizing cached items in Laravel
This package is a complementary use of Laravel Cache, developed based on the syntax of Cache Tag.
Cache Tag creates separate namespaces for different tag combinations to store cache items. A cache item named FOOBAR can exist in different tag namespaces and have different values.
Cache Label only establishes the reference relationship between labels and cache items. A cache item named FOOBAR will be the only item in the entire cache store.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
Storing labeled cache items
Accessing labeled cache items
The following statements return the same value.
The cache key must exist in each label, otherwise the empty or default value will be returned.
Flushing labeled cache items
Clear the value of items associated with the labels, but still remember the cache keys for further use.
Resetting labels
Let the label no longer track any cache items, but does not clear the values of its previous associated cache items.
Calling forget() with labels()
When forget() is called with labels(), the value of the cache item is cleared, but the label does not forget the key of the cache item. This behavior can be changed by modifying config('cache-label.forget_and_remove'). When set to true, the label will forget the cache key after its value has been cleared.
By default
Setting config('cache-label.forget_and_remove') to true
Calling flush() with labels()
When flush() is called, all items in the entire cache store will be flushed, regardless of whether labels() is used or not. This behavior can be changed by modifying config('cache-label.flush_behavior'). However, this is not recommended, and it is better to use flushLabels() or resetLabels() to manipulate the labeled items.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-cache-label with dependencies
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^8.0|^9.0