Home  >  Article  >  Backend Development  >  []APC高手~APC取出全部的缓存的条目,有什么办法

[]APC高手~APC取出全部的缓存的条目,有什么办法

WBOY
WBOYOriginal
2016-06-13 10:09:22712browse

[求助]求救APC高手~~~APC取出全部的缓存的条目,有什么办法?
假如不清楚缓存的条目都有哪些key,还有办法取出全部的缓存条目吗?
求救APC高手~~~

------解决方案--------------------
用迭代器 + 正则得到所有缓存条目,默认应该是active的而不是delete的.

PHP code
<?phpfor ($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:test0key:pos_1 -> value:test1key:pos_2 -> value:test2key:pos_3 -> value:test3key:pos_4 -> value:test4key:pos_5 -> value:test5key:pos_6 -> value:test6key:pos_7 -> value:test7key:pos_8 -> value:test8key:pos_9 -> value:test9*/                                                    ?><div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn