Skip to content

The package helpful about migrating redis cache for seamless deploys

License

Notifications You must be signed in to change notification settings

haydar/cache-migration

Repository files navigation

Laravel Cache Migration

The package is developed for make seamless deploys. You can delete your cache by adding the desired redis keys to the migration file.

Requirement

  • Laravel >= 5.x
  • PHP >= 7.1

Installation

Install via composer

composer require haydarsahin/cache-migration

Run migration for creating cache-migrations table.

php artisan migrate

Usage

The cache migrations is analogous with normal migration.

Create a migration file.

php artisan make:cache-migration UsersCacheForget

Type pattern or patterns which you want to forget to patterns array.

<?php

class UserCacheForget
{

   /*
   |--------------------------------------------------------------------------
   | Cache Migration File
   |--------------------------------------------------------------------------
   |
   | Redis keys that you wish to clear should be added to the patterns array.
   | Invalid patterns: '*', less than 3 characters.
   |
   */

    public $patterns = [
        'users:*',
        'report:users:*:performance:*:dateRange:*:volumes',
        'specificCacheKey:101:userId'
    ];
}

Run pending migrations manually or add this code to your deployment pipeline.

php artisan cache:migrate

Testing

composer test

Changelog

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

Security

If you discover any security related issues, please email instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

About

The package helpful about migrating redis cache for seamless deploys

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages