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

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

WBOY
Release: 2016-06-13 13:39:25
Original
865 people have browsed it

[求助]求救APC高手~~~APC取出全部的缓存的条目,有什么办法?
假如不清楚缓存的条目都有哪些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
*/                                                    
?> <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template