Package

Abr4Xas Cache Ui Laravel

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

Package

abr4xas/cache-ui-laravel

View on GitHub →
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 Cache Ui Laravel Related Articles

Caching With MongoDB for Faster Laravel Apps image

Caching With MongoDB for Faster Laravel Apps

Read article
Interactively Search and Delete Cache Keys in Laravel with Cache UI image

Interactively Search and Delete Cache Keys in Laravel with Cache UI

Read article
Memoize Tagged Cache Reads in Laravel image

Memoize Tagged Cache Reads in Laravel

Read article
Efficiently remove expired cache data with Laravel Cache Evict image

Efficiently remove expired cache data with Laravel Cache Evict

Read article
Laravel Cache Helper Package image

Laravel Cache Helper Package

Read article
Dynamic Cache, Database, and Mail Builders in Laravel 11.31 image

Dynamic Cache, Database, and Mail Builders in Laravel 11.31

Read article

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

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

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift