Giter VIP home page Giter VIP logo

cachetoolbundle's Introduction

CacheToolBundle

This bundle allows you to integrate CacheTool with Symfony2.

Installation

{
    "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: ~

Configuration

There are two adapters

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

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
cache_tool:
    apc: false
# app/config/config.yml
cache_tool:
    opcache: false

Usage

Commands

  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

Service

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

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

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->setAdapter($adapter);
$cache->addProxy(new Proxy\ApcProxy());
$cache->addProxy(new Proxy\PhpProxy());

You can read more information at CacheTool's page.

License

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

cachetoolbundle's People

Contributors

gordalina avatar hacfi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.