すでに皆さんのset_include_pathあるいはcomposer.jsonに記述されてるZend Frameworkを使います。
<?php
$storage = Zend\Cache\StorageFactory::factory(array(
'adapter' => array(
'name' => 'Filesystem',
'options' => array('cache_dir' => __DIR__.'/cache')
),
'plugins' => array(
'serializer' => array(
'serializer' => 'Zend\Serializer\Adapter\MsgPack'
)
),
));
$storage->setItem('foo', 'bar');
PHPで実行することによりignore_user_abort()もごくごく自然に組み合わせられます。
<?php
$storage->addPlugin(new Zend\Cache\Storage\Plugin\IgnoreUserAbort);