SimpleXMLElement对象的APC缓存数组


APC Caching array of SimpleXMLElement objects

缓存SimpleXMLElement对象数组时遇到困难。是apc_store行失败了,我不知道为什么。

程序在这一行终止,这很奇怪,因为我在其他地方也用过——将数组封装在ArrayObject中并存储在缓存中。

我的代码摘录如下:

    $feed = /* some url */
    $xml = simplexml_load_file($feed);
    $items = $xml -> xpath('/rss//item');
    foreach($items as $item){
        $item -> addChild('myTag1', "My Tag 1");
        $item -> addChild('myTag2', "My Tag 2");
    }
    apc_store($feed, new ArrayObject($items), 60);

我认为我的日志文件工作不正常,这是最后一个条目,以防万一它有帮助,但我认为这与SSL有关,在这里没有帮助:

[Wed Feb 20 12:21:51 2013] [notice] caught SIGTERM, shutting down
Attempt to free unreferenced scalar: SV 0x7fe7805e2130, Perl interpreter: 0x7fe7805ea4f0 during global destruction.
[Wed Feb 20 12:21:54 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Feb 20 12:21:54 2013] [notice] SSL FIPS mode disabled
Attempt to free unreferenced scalar: SV 0x7f94bfa75ec0, Perl interpreter: 0x7f94bfa56550 during global destruction.
[Wed Feb 20 12:21:57 2013] [notice] Digest: generating secret for digest authentication ...
[Wed Feb 20 12:21:57 2013] [notice] Digest: done
[Wed Feb 20 12:21:59 2013] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Wed Feb 20 12:21:59 2013] [notice] mod_python: using mutex_directory /tmp 
[Wed Feb 20 12:21:59 2013] [notice] SSL FIPS mode disabled
[Wed Feb 20 12:21:59 2013] [notice] Apache/2.2.22 (Unix) DAV/2 PHP/5.4.10 mod_python/3.3.1    Python/2.7.3 mod_ssl/2.2.22 OpenSSL/1.0.0j-fips mod_perl/2.0.5 Perl/v5.14.3 configured -- resuming   normal operations

谢谢你的帮助。

在上面的例子中,$feed不是url的字符串表示;它是一个数组,其第一个元素是url的字符串表示。此外,我使用了名称空间,所以ArrayObject需要一个斜杠前缀。