grork / laravel-cache-commands
Artisan commands to manage easily cache items
This package is not auto-updated.
Last update: 2020-10-31 06:35:33 UTC
README
Laravel Cache Commands is a set of Artisan Commands to manage the cache items directly from your CLI, enabling you to retrieve, store or remove keys.
License
Cache Commands is open-sourced software licensed under the MIT license
Install
To get started with Cache Commands, use Composer to add the package to your project's dependencies:
composer require grork/laravel-cache-commands
After this, register the Grork\CacheCommands\CacheCommandsServiceProvider
in your config/app.php
configuration file:
'providers' => [ // Other service providers... Grork\CacheCommands\CacheCommandsServiceProvider::class, ],
Usage
Retrieve
To retrieve an item from the cache, you can use the command php artisan cache:get <key> [<store>]
.
Key is the item key.
Store (optional) is the store from which you want to retrieve it.
Store
To store an item, you can use the command php artisan cache:store <key> <value> [<expiration>] [<store>]
.
If an item already exists in cache, you will be prompted if you want to overwrite it. Currently arrays and objects are no supported for store action.
Key is the item key.
Value is the value. It supports strings, numbers and booleans. At this time, no array or object are supported.
Duration (optional) is the duration of the item in minutes (i.e. if you want item for an hour, this will be 60). Otherwise, you can pass forever as value to store it with no expiration. Default value: 60
Store (optional) is the store from which you want to retrieve it.
Forget
To forget an item, you can use the command php artisan cache:forget <key> [<store>]
.
Key is the item key.
Store (optional) is the store from which you want to retrieve it.