1
1

More than 5 years have passed since last update.

PHPでMsgPackでキャッシュする

Last updated at Posted at 2013-02-26

すでに皆さんの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);
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1