【问题标题】:Replacement for Zend_Cache::factory in Zend Framework 3Zend Framework 3 中 Zend_Cache::factory 的替换
【发布时间】:2019-04-16 08:38:10
【问题描述】:

我正在寻找一种解决方案来替换 Zend 3 应用程序中的 Zend 1/2 缓存。旧应用程序正在使用

$cache = Zend_Cache::factory('Core', 'File, $frontendOptions, $backendOptions)

获取缓存实例。如何在 Zend Framework 3 中获得相同的实例?

【问题讨论】:

标签: zend-framework3 zend-cache


【解决方案1】:

看看这段代码。完整描述可查看here

$cache = \Zend\Cache\StorageFactory::factory([
    'adapter' => [
        'name' => 'filesystem',
        'options' => [
            'namespace' => 'builder',
        ],
    ],
    'options' => [
        'cache_dir' => 'data/cache',
    ],
    'plugins' => [
        'exception_handler' => [
            'throw_exceptions' => true,
        ],
        'Serializer',
    ],
]);

【讨论】:

    猜你喜欢
    • 2017-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-19
    • 1970-01-01
    • 1970-01-01
    • 2020-12-21
    • 2018-04-19
    相关资源
    最近更新 更多