Skip to content

CacheWithLock package for Laravel framework - overrides remember method of Laravel Cache using lock mechanism to avoid multiply generation of the same data.

License

Notifications You must be signed in to change notification settings

enikeishik/cachewithlock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CacheWithLock

Package for Laravel framework - overrides remember method of Laravel Cache using lock mechanism to avoid multiply generation of the same data (as a result of race condition) when cache becomes invalid.

Requirements

  • PHP >= 7.4
  • Laravel >= 7.0

Install

Install (or update) package via composer:

composer require enikeishik/cachewithlock

Make sure autoload will be changed:

composer dump-autoload

Publish package via artisan:

php artisan vendor:publish --provider="Enikeishik\CacheWithLock\ServiceProvider"

This command copy configuration file into corresponding project folder.

Usage

Package service provider contains an extend call to override Laravel Cache class. So there is no need to make any changes in code.

Overriding can be disabled in package configuration.

Without overriding Laravel Cache use CacheWithLock facade:

use CacheWithLock;

...

$value = CacheWithLock::remember(...);

...

About

CacheWithLock package for Laravel framework - overrides remember method of Laravel Cache using lock mechanism to avoid multiply generation of the same data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages