【问题标题】:ZF2 Doctrine2 Pagination CacheZF2 Doctrine2 分页缓存
【发布时间】:2013-05-17 13:54:56
【问题描述】:

你们中有人知道如何为 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

消息: 生成迭代器时出错

【问题讨论】:

    标签: caching doctrine-orm pagination zend-framework2


    【解决方案1】:

    嵌套不正确:

    $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;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-06
      • 1970-01-01
      • 2013-09-22
      • 1970-01-01
      • 2016-03-20
      • 1970-01-01
      相关资源
      最近更新 更多