在Zend Framework 3中替换Zend_Cache :: factory

问题描述 投票:0回答:1

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

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

获取缓存实例。我怎样才能在Zend Framework 3中获得相同的实例?

zend-framework3 zend-cache
1个回答
0
投票

看看这段代码。完整的描述可以找到here

$cache = \Zend\Cache\StorageFactory::factory([
    'adapter' => [
        'name' => 'filesystem',
        'options' => [
            'namespace' => 'builder',
        ],
    ],
    'options' => [
        'cache_dir' => 'data/cache',
    ],
    'plugins' => [
        'exception_handler' => [
            'throw_exceptions' => true,
        ],
        'Serializer',
    ],
]);
© www.soinside.com 2019 - 2024. All rights reserved.