2017 © Pedro Peláez
 

cakephp-plugin cakephp-cachecleaner

CacheCleaner plugin for CakePHP, this shell clean the cache of your application.

image

daoandco/cakephp-cachecleaner

CacheCleaner plugin for CakePHP, this shell clean the cache of your application.

  • Friday, April 15, 2016
  • by ozee31
  • Repository
  • 2 Watchers
  • 0 Stars
  • 61 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

CacheCleaner plugin for CakePHP

This plugin is a shell that cleans the cache in your application, (*1)

Requirements

  • PHP version 5.4.16 or higher
  • CakePhp 3.0 or higher

Installation

You can install this plugin into your CakePHP application using composer., (*2)

The recommended way to install composer packages is:, (*3)

composer require daoandco/cakephp-cachecleaner

Loading the Plugin, (*4)

  // In config/bootstrap.php
  Plugin::load('CacheCleaner', ['bootstrap' => true, 'routes' => false]);

Quick Start

Clear all cache, (*5)

bin/cake CacheCleaner.clear -a

Clear cake cache, (*6)

bin/cake CacheCleaner.clear cake

Tasks

ORM

It's the equivalent to orm_cache clear. See more informations, (*7)

bin/cake CacheCleaner.clear orm

Cake

Clear the cache generate by Cake\Cache\Cache, (*8)

bin/cake CacheCleaner.clear cake

Opcache

Resets the entire opcode cache, See more informations, (*9)

bin/cake CacheCleaner.clear opcache

Dir

Clear directories in "tmp/cache/", (*10)

  • Clear all directories
bin/cake CacheCleaner.clear dir -a
  • Clear one directory
bin/cake CacheCleaner.clear dir dir_name
  • Clear many directories
bin/cake CacheCleaner.clear dir dir_name other_dir_name

Configuration

Create config file

Create a file in app/config like 'vendor/daoandco/cakephp-cachecleaner/config/config.php', (*11)

<?php
// config/cachecleaner.php


return [
    'CacheCleaner' => [
        'tasks' => ['CacheCleaner.Dir', 'CacheCleaner.Orm', 'CacheCleaner.Cake', 'CacheCleaner.Opcache'],

        'Dir' => [
            'dirs' => true,
        ],
    ]
];

Load configuration

<?php
// In config/bootstrap.php

Configure::load('cachecleaner', 'default');

Options

  • tasks : add or remove tasks Exemple : if you do not want Opcache you can write
tasks' => ['CacheCleaner.Dir', 'CacheCleaner.Orm', 'CacheCleaner.Cake'],
  • Dir.dirs : choose the folders to clear Exemple : if you want clear only persistent forler you can write
'Dir' => [
    'dirs' => ['persistent'],
],

Create a new task for your usage

You can add your own tasks, Your class must implement Task Interface, (*12)

Create the task

// In Shell/Task

namespace App\Shell\Task;

use Cake\Console\Shell;
use Cake\Console\ConsoleOptionParser;
use CacheCleaner\Shell\Task\TaskInterface;

class DemoTask extends Shell implements TaskInterface {

    public function getOptionParser() {
        $parser = new ConsoleOptionParser('console');
        $parser
            ->description("Task description")
            ->command("demo")
            ;
        return $parser;
    }

    public function help() {
        return 'Task description';
    }

    public function main() {
        // call with de command : "bin/cake CacheCleaner.clear demo"
        $this->success('OK');
    }

    public function all() {
        // call with de command : "bin/cake CacheCleaner.clear demo -a"
        $this->success('OK');
    }
}

Load the task

<?php
// In config/cachecleaner.php

return [
    'CacheCleaner' => [
        'tasks' => ['CacheCleaner.Dir', 'CacheCleaner.Orm', 'CacheCleaner.Cake', 'CacheCleaner.Opcache', 'Demo'],

        'Dir' => [
            'dirs' => true,
        ],
    ]
];

The Versions

15/04 2016

dev-master

9999999-dev

CacheCleaner plugin for CakePHP, this shell clean the cache of your application.

  Sources   Download

The Requires

 

The Development Requires

15/04 2016

v1.0.1

1.0.1.0

CacheCleaner plugin for CakePHP, this shell clean the cache of your application.

  Sources   Download

The Requires

 

The Development Requires

15/04 2016

v1.0.0

1.0.0.0

CacheCleaner plugin for CakePHP, this shell clean the cache of your application.

  Sources   Download

The Requires

 

The Development Requires