Package Data | |
---|---|
Maintainer Username: | maherio |
Maintainer Contact: | amaher@alumni.nd.edu (Tony Maher) |
Package Create Date: | 2014-10-26 |
Package Last Update: | 2014-12-04 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-30 03:03:49 |
Package Statistics | |
---|---|
Total Downloads: | 5,095 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 5 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This package is a simple way to optimize performance by never allowing a flood of requests to hit the database (or other data source).
When a cache value expires, requests go directly to the data store. However, if this cache clear happens during a traffic spike, many more requests will fall through than you might like. The effects of this can vary from slightly slower response times, to violating an API's rate limiting, to actually crashing your database.
Instead of allowing all requests to fallback to the database, we will detect when a cache value is about to expire and instead extend it's life for subsequent requests while fetching the updated value from the source.
As you can see, there is always a valid cached value. Thus, many fewer requests actually hit the database (or api or any other layer you want hidden behind the cache).
In the require
key of composer.json
file add the following
"maherio/graceful-cache": "1.0.*"
Run the Composer update comand
$ composer update
In your config/app.php
add 'GracefulCache\ServiceProvider'
to the end of the $providers
array
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...
'GracefulCache\ServiceProvider',
),