2017 © Pedro Peláez
 

library response-cache

Laravel 5 Response Cache Middleware

image

media24si/response-cache

Laravel 5 Response Cache Middleware

  • Wednesday, February 10, 2016
  • by BostjanOb
  • Repository
  • 1 Watchers
  • 2 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Response cache

Software License Build Status, (*1)

Laravel 5 response cache., (*2)

Install

Require this package with Composer (Packagist), using the following command:, (*3)

``` bash $ composer require media24si/response-cache, (*4)


Register the ResponseCacheServiceProvider to the providers array in `config/app.php` ``` php Media24si\ResponseCache\ResponseCacheServiceProvider::class

Publish vendor files (config file): ``` bash $ php artisan vendor:publish, (*5)


To access cache manager register facade in `config/app.php` ``` php 'ResponseCacheManager' => Media24si\ResponseCache\Facades\ResponseCacheManagerFacade::class

Usage

Register middleware as a global in app/Http/Kernel.php ``` php \Media24si\ResponseCache\Http\Middleware\CacheMiddleware::class, (*6)


To cache response, mark response as public and set max-age (TTL): ``` php return response()->json(['name' => 'John']) ->setPublic() ->setMaxAge(600);

Tag usage

Many times you want to assing tags to URI. With assigned tags it's simple to clear more cached URIs., (*7)

To assign tag to caching response, set cache-tags header. To assign more tags, seperate them with comma (,)., (*8)

To cache response, mark response as public and set max-age (TTL): ``` php return response()->json(['name' => 'John']) ->setPublic() ->setMaxAge(600) ->header('cache-tags', 'foo,bar,john,doe');, (*9)


To flush all keys for tag: ``` php ResponseCacheManager::flushTag('foo')

Config

Check responseCache.php for all possible configurations., (*10)

License

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

The Versions

10/02 2016

dev-master

9999999-dev https://github.com/Media24si/ResponseCache

Laravel 5 Response Cache Middleware

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel cache response laravel 5

10/09 2015

v0.1

0.1.0.0 https://github.com/Media24si/ResponseCache

Laravel 5 Response Cache Middleware

  Sources   Download

MIT

The Requires

 

laravel cache response laravel 5