承接 achillesp/matryoshka 相关项目开发

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

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

achillesp/matryoshka

Composer 安装命令:

composer require achillesp/matryoshka

包简介

Russian Doll Caching for Laravel.

README 文档

README

Matryoshka is a package for Laravel that provides Russian-Doll caching for views. This package is based on a series of laracasts lessons with a few modifications See Laracasts.com.

Installation

Step 1: Composer

From the command line, run:

composer require achillesp/matryoshka

Step 2: Service Provider (Laravel < 5.5)

For your Laravel app, open config/app.php and, within the providers array, append:

Achillesp\Matryoshka\MatryoshkaServiceProvider::class

Config

This package uses a config file which you can override by publishing to your config dir.

php artisan vendor publish --provider=MatryoshkaServiceProvider --tag=config

In the config file you can set the tag that the cache uses. If you can't use a cache that supports tagging, set it to null.

Also in the config file, you can set whether you want to flush caches on your local machine to help with development.

Usage

To use the plugin, you use the blade directives @cache and @endcache in your views. The directive needs an identifier, which can be either a unique string, a Model or a Collection.

Caching HTML

@cache('my-cache-key')
    <div>
        <h1>Hello World</h1>
    </div>
@endcache

Caching Models

@cache($post)
    <article>
        <h2>{{ $post->title }}></h2>
        <p>Written By: {{ $post->author->username }}</p>

        <div class="body">{{ $post->body }}</div>
    </article>
@endcache

In order to cache a Model, one more step is needed. You need to use the Cacheable trait in your Model.

use Achillesp\Matryoshka\Cacheable;

class Post extends Eloquent
{
    use Cacheable;
}

Caching Collections

@cache($posts)
    @foreach ($posts as $post)
        @include ('post')
    @endforeach
@endcache

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固