modette/cache-cleaner

This package is abandoned and no longer maintained. No replacement package was suggested.

Cache cleaner for Nette application.

This package has no released version yet, and little information is available.


README

Clean application cache with single command

Installation

The best way to install modette/cache-cleaner is using Composer:

$ composer require modette/cache-cleaner

Register in your config.neon:

extensions:
    cacheCleaner: Modette\CacheCleaner\DI\CleanerExtension

Configuration

cacheCleaner:
    cleaners: # cleaners list
        - Modette\CacheCleaner\Cleaners\LocalFilesystemCleaner([%tempDir%])
        - Modette\CacheCleaner\Cleaners\NetteCachingStorageCleaner()

Available cleaners

APC cleaner

  • cleans both user and system APC cache
Modette\CacheCleaner\Cleaners\ApcCleaner()

APCu cleaner

Modette\CacheCleaner\Cleaners\ApcuCleaner()

Local filesystem cleaner

  • recursively purge directories
  • second parameter accepts directories and files which should be ignored
Modette\CacheCleaner\Cleaners\LocalFilesystemCleaner([%tempDir%], [%tempDir%/ignored/])

Memcache cleaner

  • cleans all Memcache storages in DI container
Modette\CacheCleaner\Cleaners\MemcacheCleaner()

Memcached cleaner

  • cleans all Memcached storages in DI container
Modette\CacheCleaner\Cleaners\MemcachedCleaner()

Nette caching storage cleaner

  • cleans all Nette\Caching\IStorage instances in DI container
Modette\CacheCleaner\Cleaners\NetteCachingStorageCleaner()

Opcode cleaner

  • cleans opcode
Modette\CacheCleaner\Cleaners\OpcodeCleaner()

Usage - via CLI

Run command in Symfony console

$ cache:clean

Add -v parameter to display more detailed informations

Usage - direct

<?php
// get Modette\CacheCleaner\CacheCleaner from DI container
$cleaner->clean(new \Symfony\Component\Console\Output\NullOutput());

Creating your own cleaners

Implement ICleaner and register it in cleaners list

<?php

class YourCleaner implements \Modette\CacheCleaner\Cleaners\ICleaner
{

    public function clean(\Symfony\Component\Console\Output\OutputInterface $output): void
    {
        // clean cache
        // inform about it in console
    }

}

Repository of package: https://github.com/modette/cache-cleaner.