Cache Ui Laravel

Cache Ui Laravel stats

Downloads
8
Stars
4
Open Issues
0
Forks
0

View on GitHub →

List, search and delete individual cache keys without having to purge the entire cache

Cache UI Laravel

Cache UI Laravel

A Laravel package that allows you to list, search and delete individual cache keys without having to purge the entire cache. Supports multiple cache drivers (Redis, File, Database) with an interactive command line interface.

Installation

You can install the package via composer:

composer require abr4xas/cache-ui-laravel

Optionally, you can publish the config file with:

php artisan vendor:publish --tag="cache-ui-laravel-config"

Configuration

After publishing the config file, you can customize the package behavior:

return [
// Default cache store to use
'default_store' => env('CACHE_UI_DEFAULT_STORE', null),
 
// Character limit in value preview
'preview_limit' => env('CACHE_UI_PREVIEW_LIMIT', 100),
 
// Number of visible items in scroll
'search_scroll' => env('CACHE_UI_SEARCH_SCROLL', 15),
];

You can also configure these values in your .env file:

CACHE_UI_DEFAULT_STORE=redis
CACHE_UI_PREVIEW_LIMIT=150
CACHE_UI_SEARCH_SCROLL=20

Usage

Basic Command

Run the command to list and manage cache keys:

php artisan cache:list

Specify a Cache Store

If you have multiple cache stores configured, you can specify which one to use:

php artisan cache:list --store=redis

Features

  • 🔍 Interactive search: Search cache keys by typing text
  • 📋 List all keys: View all available keys in your cache
  • 🗑️ Selective deletion: Delete individual keys without affecting the rest of the cache
  • 🔌 Multiple drivers: Supports Redis, File and Database

Supported Drivers

  • Redis: Lists all keys using Redis KEYS command
  • File: Reads cache files from the filesystem
  • Database: Queries the cache table in the database
  • ⚠️ Array: Not supported (array driver doesn't persist between requests)
  • ⚠️ Memcached: Not currently supported

Usage Example

$ php artisan cache:list
 
📦 Cache driver: redis
Found 23 cache keys
 
🔍 Search and select a cache key to delete
> user_1_profile
 
📝 Key: user_1_profile
 
Are you sure you want to delete this cache key? No / Yes
 
🗑️ The key 'user_1_profile' has been successfully deleted

Programmatic Usage (optional)

You can also use the CacheUiLaravel class directly in your code:

use Abr4xas\CacheUiLaravel\Facades\CacheUiLaravel;
 
// Get all cache keys from default store
$keys = CacheUiLaravel::getAllKeys();
 
// Get all cache keys from a specific store
$redisKeys = CacheUiLaravel::getAllKeys('redis');
 
// Delete a specific key from default store
$deleted = CacheUiLaravel::forgetKey('user_1_profile');
 
// Delete a key from a specific store
$deleted = CacheUiLaravel::forgetKey('session_data', 'redis');

Testing

composer test:unit

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

abr4xas photo

SR Backend (PHP / Laravel / WordPress) developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Abr4Xas Cache Ui Laravel Related Articles

Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian