承接 media24si/response-cache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

media24si/response-cache

最新稳定版本:v0.1

Composer 安装命令:

composer require media24si/response-cache

包简介

Laravel 5 Response Cache Middleware

README 文档

README

Software License Build Status

Laravel 5 response cache.

Install

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

$ composer require media24si/response-cache

Register the ResponseCacheServiceProvider to the providers array in config/app.php

Media24si\ResponseCache\ResponseCacheServiceProvider::class

Publish vendor files (config file):

$ php artisan vendor:publish

To access cache manager register facade in config/app.php

'ResponseCacheManager' => Media24si\ResponseCache\Facades\ResponseCacheManagerFacade::class

Usage

Register middleware as a global in app/Http/Kernel.php

\Media24si\ResponseCache\Http\Middleware\CacheMiddleware::class

To cache response, mark response as public and set max-age (TTL):

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.

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

To cache response, mark response as public and set max-age (TTL):

return response()->json(['name' => 'John'])
		->setPublic()
		->setMaxAge(600)
		->header('cache-tags', 'foo,bar,john,doe');

To flush all keys for tag:

ResponseCacheManager::flushTag('foo')

Config

Check responseCache.php for all possible configurations.

License

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

统计信息

  • 总下载量: 132
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-25