- Notifications
You must be signed in to change notification settings - Fork2
Laravel configurable cache manager
License
salehhashemi1992/laravel-configurable-cache
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- Provides configurable cache settings with dedicated ttl and prefix for each
- Supports all main cache operations provided by Laravel, such as put, get, increment, and delete
PHP: ^8.1Laravel framework: ^9
| Version | L9 | L10 | L11 |
|---|---|---|---|
| 1.4 | ✅ | ✅ | ✅ |
You can install the package via composer:
composer require salehhashemi/laravel-configurable-cache
Next, from the command line type:
php artisan vendor:publish --provider="Salehhashemi\ConfigurableCache\ConfigurableCacheServiceProvider"Finally, adjust the settings in the published configuration file located inconfig/configurable-cache.php as per yourrequirements.
To use the package, you can use theConfigurableCache class methods. Here's an example:
useSalehhashemi\ConfigurableCache\ConfigurableCache;// Storing an item in the cache with `_tiny_` prefix for 15 minutesConfigurableCache::put('testKey','Hello World!','tiny');// Retrieving an item from the cache with `_short_` prefix that is stored for an hour$value = ConfigurableCache::get('testKey','short');// Delete a cache item with `_otp_` prefixConfigurableCache::delete('testKey','otp');// if `testKey` doesn't exist in the 'default' cache, the Closure will be executed and its result will be stored in the cache under `testKey` with `_default_` prefix$value = ConfigurableCache::remember('testKey',function () {return'Hello World!';});
You can change these configurations in your configurable-cache.php config file:
'configs' => [ 'default' => [ 'prefix' => '_default_', 'duration' => '+1 Year', ], 'tiny' => [ 'prefix' => '_tiny_', 'duration' => '+15 minutes', ], 'short' => [ 'prefix' => '_short_', 'duration' => '+1 hour', ], 'otp' => [ 'prefix' => '_otp_', 'duration' => '+3 minutes', ],]composertestPlease seeCHANGELOG for more information what has changed recently.
Please seeCONTRIBUTING for details.
The MIT License (MIT). Please seeLicense File for more information.
About
Laravel configurable cache manager
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
