0

你们中有人知道如何使用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\Cache\Storage\Adapter\Filesystem.php:1549

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

\Zend\Cache\Storage\Adapter\Filesystem.php:1553

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

\Zend\Paginator\Paginator.php:637

消息:生成迭代器时出错

4

1 回答 1

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;
于 2013-10-12T13:34:45.913 回答