m-shimao/find-in-file-cache

File Cache plugin for CakePHP

dev-master 2017-01-31 05:04 UTC

This package is not auto-updated.

Last update: 2024-05-25 18:15:27 UTC


README

What is it for?

It is model behavior for static models. If you want to use file cache for static model, this plugin is easy to use.

Installation

You can install this plugin into your CakePHP application using composer. The recommended way to install composer packages is:

composer require m-shimao/find-in-file-cache dev-master

Also don't forget to load the plugin in your bootstrap:

Plugin::load('FindInFileCache');
// or
Plugin::loadAll();

Usage

Table

<?php
class CategoriesTable extends Table
{
    public function initialize(array $config)
    {
        $this->addBehavior('FindInFileCache.FindInFileCache');
    }
}

Config

Default Setting is below.

'className' => 'File',↲
'prefix' => 'myapp_cake_static_record_',↲
'path' => CACHE . 'static_records/',↲
'duration' => '+15 minutes',↲
'mask' => 0666,↲

If you use original setting, please edit cache section in app.php.

<?php
return [
...
    'Cache' => [
        ...
        'find-in-file' => [
            'className' => 'File',↲
            <type your setting>
        ],
        ...
    ],
...
];