mintbridge / laravel-cache-filter by mintbridge

Laravel route filter for caching responses
20
2
0
Package Data
Maintainer Username: mintbridge
Maintainer Contact: paul.dixon@mintbridge.co.uk (Paul Dixon)
Package Create Date: 2014-06-15
Package Last Update: 2014-06-15
Language: PHP
License: MIT
Last Refreshed: 2024-04-15 03:05:12
Package Statistics
Total Downloads: 20
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 0
Total Forks: 0
Total Open Issues: 0

Laravel Cache Filter

Often you have responses that don't change very often, this package lets you store these responses in the cache and then return them automatically using a filter the next time they are requested.

Installation

Begin by installing this package through Composer.

{
    "require": {
		"mintbridge/laravel-cache-filter": "1.0.x"
	}
}

Then add the service provider to you app config.


// app/config/app.php

'providers' => [
    '...',
    'MintBridge\LaravelCacheFilter\LaravelCacheFilterServiceProvider'
];

Usage

The package provide 2 filters, these can be used with Laravels before and after route filters:

Route::get('some-route', array(
	'before' => 'cache.response.fetch',
	'after' => 'cache.response.store',
	...
));

The fetch filter will check to see if the response has been cached and if so return it. The store filter takes the generated response and adds it to the cache ready for the next time it is requested.