【发布时间】:2017-07-24 02:29:20
【问题描述】:
这是我的缓存初始化代码:
use Zend\Cache\StorageFactory;
$cache = StorageFactory::factory(array(
'adapter' => array(
'name' => 'filesystem',
// With a namespace we can indicate the same type of items
// -> So we can simple use the db id as cache key
'options' => array(
'namespace' => 'dbtable',
'cache_dir' => Pluto::path('cache')
),
),
'plugins' => array(
// Don't throw exceptions on cache errors
'exception_handler' => array(
'throw_exceptions' => false
),
// We store database rows on filesystem so we need to serialize them
'Serializer'
)
));
我想知道的是如何获取我们在这个缓存对象中的所有缓存键
例如,现在执行这段代码:
$cache->setItem('key1','foo');
$cache->setItem('key2','bar');
$cache->setItem('key3','baz');
并在不同的区域/点执行此代码:
$cache->setItem('key4','foo2');
$cache->setItem('key5','bar2');
$cache->setItem('key6','baz2');
我想要一个包含['key1','key2','key3','key4','key5','key6'] 的数组,它可能来自缓存对象内所有键的内部数组(包括在此特定请求期间未受影响的那些)?
【问题讨论】:
标签: php zend-framework zend-framework2 zend-framework3 zend-cache