Waavi / responsecache by sildraug

Response cache for Laravel 5.1
275
2
2
Package Data
Maintainer Username: sildraug
Maintainer Contact: info@waavi.com (Waavi)
Package Create Date: 2015-12-23
Package Last Update: 2017-08-10
Language: PHP
License: MIT
Last Refreshed: 2024-04-15 15:14:55
Package Statistics
Total Downloads: 275
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

HTTP Response Cache for Laravel 5

Latest Version on Packagist Software License Build Status Total Downloads

Developed for Laravel 5.1 and based on Spatie's Response cache this package allows you to cache successful GET Requests for non logged in users.

WAAVI is a web development studio based in Madrid, Spain. You can learn more about us at waavi.com

Laravel compatibility

Laravel | translation :---------|:---------- 5.1.x | 1.0.x 5.2.x | 1.0.1 and up 5.3.x | 1.0.2 and up

Installation

You may install the package via composer

composer require waavi/responsecache 1.x

Add the service provider:

// config/app.php

'providers' => [
    ...
    \Waavi\ResponseCache\ResponseCacheServiceProvider::class,
];

To enable the ResponseCache facade:

// config/app.php

'aliases' => [
    ...
   'ResponseCache' => \Waavi\ResponseCache\Facades\ResponseCache::class,
];

Publish the config file

php artisan vendor:publish --provider="Waavi\ResponseCache\ResponseCacheServiceProvider"

Usage

Cache middleware

You may now use the cache middleware in your routes to cache successful GET requests from non logged in users. By default responses a cached for 24 hours.

// app/Http/routes.php

Route::get('/', ['middleware' => 'cache', 'uses' => 'HomeController@home']);

Clearing the cache

You may clear the cache using the provided facade:

\ResponseCache::clear();

Or through the provided artisan command

php artisan responsecache:clear

In case your cache store allows for tags, then only the response cache will be cleared. Otherwise your whole app cache will be cleared.