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

CacheTool Symfony2 Bundle

1.7.0 2015-02-12 02:05 UTC

This package is auto-updated.

Last update: 2023-06-20 05:08:58 UTC


This bundle allows you to integrate CacheTool with Symfony2.


    "require": {
        "gordalina/cachetool-bundle": "~1.0"

Register the bundle in app/Appkernel.php:

// app/AppKernel.php

public function registerBundles()
    return array(
        // ...
        new CacheTool\Bundle\CacheToolBundle(),

Enable the bundle's configuration in app/config/config.yml:

# app/config/config.yml
cache_tool: ~


There are two adapters

  1. CLI
# app/config/config.yml
    adapter: cli
  1. FastCGI
# app/config/config.yml
    adapter: fastcgi

You can also connect by socket replacing the above by: /var/run/php5-fpm.sock.

If you don’t need apc or opcache you can disable it by setting it to false:

# app/config/config.yml
    apc: false
# app/config/config.yml
    opcache: false



  cachetool:apc:bin:dump                   Get a binary dump of files and user variables
  cachetool:apc:bin:load                   Load a binary dump into the APC file and user variables
  cachetool:apc:cache:info                 Shows APC user & system cache information
  cachetool:apc:cache:info:file            Shows APC file cache information
  cachetool:apc:key:delete                 Deletes an APC key
  cachetool:apc:key:exists                 Checks if an APC key exists
  cachetool:apc:key:fetch                  Shows the content of an APC key
  cachetool:apc:key:store                  Store an APC key with given value
  cachetool:apc:sma:info                   Show APC shared memory allocation information
  cachetool:cache:clear:dump               Clears APC cache (user, system or all)
  cachetool:opcache:configuration          Get configuration information about the cache
  cachetool:opcache:reset                  Resets the contents of the opcode cache
  cachetool:opcache:status                 Show summary information about the opcode cache
  cachetool:opcache:status:scripts         Show scripts in the opcode cache


You can access all apc and opcode functions through the cachetool service.

$cache = $container->get('cachetool');
// or

Extending CacheTool

CacheTool depends on Proxies to provide functionality, by default when creating a CacheTool instance from the factory all proxies are enabled ApcProxy, OpcacheProxy and PhpProxy, you can customize it or extend to your will like the example below:

use CacheTool\Adapter\FastCGI;
use CacheTool\CacheTool;
use CacheTool\Proxy;

$adapter = new FastCGI('/var/run/php5-fpm.sock');
$cache = new CacheTool();
$cache->addProxy(new Proxy\ApcProxy());
$cache->addProxy(new Proxy\PhpProxy());

You can read more information at CacheTool's page.


This bundle is released under the MIT license. See the complete license in the bundle.