ZF2 Doctrine2分页缓存

时间:2013-05-17 13:54:56

标签: caching doctrine-orm pagination zend-framework2

您是否有人知道如何使用doctrine2为zf2分页配置缓存?

我点的方式:

$cache = \Zend\Cache\StorageFactory::factory ( 
                                              array (
                                                    'adapter' => array (
                                                         'name' => 'Filesystem',
                                                          'options' => array (
                                                              'ttl' => 10,
                                                              'cache_dir' =>__DIR__.'/../../../data/cache/',
                                                                     ),
                                                               'plugins' => array (
                                                                   'serializer' => array(
                                                                             'serializer' => 'igbinary'
                                                                         )
                                                                     )
                                                                 )
                                                           ) );

            return $cache;

但我得到如下的例外情况。

\的Zend \缓存\存储\适配器\ Filesystem.php:1549

消息: fwrite()期望参数2为字符串,给定对象

\的Zend \缓存\存储\适配器\ Filesystem.php:1553

消息: 写入文件时出错'... \ data \ cache \ zfcache-c0 \ zfcache-Zend_Paginator_2_722b98872575050f0443b2b626605650.dat'

\ Zend的\分页程序\ Paginator.php:637

消息: 生成迭代器时出错

1 个答案:

答案 0 :(得分:0)

嵌套不正确:

$cache = \Zend\Cache\StorageFactory::factory( array(
    'adapter' => array(
        'name' => 'Filesystem',
        'options' => array (
            'ttl' => 10,
            'cache_dir' =>__DIR__.'/../../../data/cache/',
        ),
    ),
    'plugins' => array (
        'serializer' => array(
            'serializer' => 'igbinary'
        )
    )
) );
return $cache;
相关问题