略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: APCIterator

2024-12-23

APCIterator ç±»

(PECL apc >= 3.1.1)

简介

APCIterator 类使得遍历大容量APC缓存更容易,这是很有帮助的因为它允许同时获取已经定义的每个被锁定实例的条目数,因此它释放的其他活动的缓存锁,而不是阻碍整个缓存以完成获取100(默认)个缓存数据的迭代,在大缓存条目。 此外,使用正则匹配效率更高,因为它被改为C级别的实现。

类摘要

APCIterator implements Iterator , Traversable {
/* Methods */
public __construct ( string $cache [, mixed $search = NULL [, int $format = APC_ITER_ALL [, int $chunk_size = 100 [, int $list = APC_LIST_ACTIVE ]]]] )
public current ( void ) : mixed
public getTotalCount ( void ) : int
public getTotalHits ( void ) : int
public getTotalSize ( void ) : int
public key ( void ) : string
public next ( void ) : void
public rewind ( void ) : void
public valid ( void ) : void
}

Table of Contents

add a noteadd a note

User Contributed Notes 1 note

up
7
Stefan W
5 years ago
This class will NOT EXIST if the APC extension is installed but disabled in your php.ini.

This is an important difference to functions like apc_store(), which will still exist and be callable even when APC is disabled. In many installations, the default settings are

   apc.enabled = on
   apc.enable_cli = off

which means that APCIterator exists for HTTP requests, but not with the "cli" SAPI. The solution is to either set "apc.enable_cli" to "on" (with the resultant startup penalty for CLI scripts), or to check the relevant ini settings before your script tries to access APCIterator.

官方地址:https://www.php.net/manual/en/class.apciterator.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3