Giter Site home page Giter Site logo

apcubundle's Introduction

Bundle APCu Build Status Total Downloads License PHP Version Require

Provide APCu support, see PECL/APCu.

Installation

Via Composer :

"require": {
    "m6web/apcu-bundle" : "^1.4"
}

Also require the PECL extension APCu :

# pecl install -f apcu

Don't forget to enable the extension in your php.ini.

NB: due to an update in APCu API, from ApcuBundle v1.1.1, you must install APCu v4.0.7 or higher

Configuration

The main configuration key is m6web_apcu. Each subkey defines a new Apcu cache service. These services are named m6web_apcu + subkey. For each service, several parameters can be set :

  • namespace (string, optional) : Empty by default. Namespace for all keys stored in APCu cache via this instance.
  • ttl (integer, optionnal) : 3600 (seconds) by default. Define the default TTL used when no TTL is given to store data.
  • class (string, optionnal) : You can override the default cache class. It should extends M6Web\Bundle\ApcuBundle\Apcu\Apcu.

Example

m6web_apcu:
    myCache:
        namespace: 6play-api-applaunch
        ttl: 3600
    otherCache: ~

Usage

$cache = $container->get('m6web_apcu.myCache');
$key   = 'myCacheKey';

var_dump($cache->exists($key)); // boolean, false

$cache->store($key, 'Hello', 3600)

var_dump($cache->exists($key)); // boolean, true
var_dump($cache->fetch($key)); // string, Hello

$cache->delete($key);

var_dump($cache->exists($key)); // boolean, false
var_dump($cache->fetch($key)); // bolean, false

Tests

If you wish to run Bundle tests, you must enable APCu in CLI environment by defining apc.enable_cli option to 1.

Then you can run the tests :

$ ./vendor/bin/phpunit tests

apcubundle's People

Contributors

jubianchi avatar lnahiro avatar mikaelrandy avatar omansour avatar systemasis avatar titoko avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

logorn

apcubundle's Issues

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.