假如不清楚缓存的条目都有哪些key,还有办法取出全部的缓存条目吗?
求救APC高手~~~
------解决方案--------------------
用迭代器 + 正则得到所有缓存条目,默认应该是active的而不是delete的.
- PHP code
<?php for($i=0;$i<10;$i++) { ${'test'.$i} = "test{$i}"; apc_store("pos_{$i}",${'test'.$i}); } $results = new APCIterator('user', '/^.*$/'); while( !!($rs = $results->current()) ) { echo "key:{$rs['key']} -> value:{$rs['value']}<br/>"; $results->next(); } /**我这边测试的结果 key:pos_0 -> value:test0 key:pos_1 -> value:test1 key:pos_2 -> value:test2 key:pos_3 -> value:test3 key:pos_4 -> value:test4 key:pos_5 -> value:test5 key:pos_6 -> value:test6 key:pos_7 -> value:test7 key:pos_8 -> value:test8 key:pos_9 -> value:test9 */ ?>