There is no license information available for the latest version (v3.0.0) of this package.

Provide APCu support

Installs: 122 848

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 50

Forks: 1

Open Issues: 1


v3.0.0 2022-08-10 07:56 UTC

This package is auto-updated.

Last update: 2023-05-10 09:51:26 UTC


Provide APCu support, see PECL/APCu.


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


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.


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


$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


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


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