downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

APCIterator::current> <APCIterator
[edit] Last updated: Fri, 24 May 2013

view this page in

APCIterator::__construct

(PECL apc >= 3.1.1)

APCIterator::__constructConstruye un objeto iterador APCIterator

Descripción

public APCIterator::__construct ( string $cache [, mixed $search = null [, int $format [, int $chunk_size = 100 [, int $list ]]]] )

Construye un object APCIterator .

Parámetros

cache

El tipo de caché, que será user o file.

search

Una expresión regular de PCRE que se compara con nombres de claves de APC, como string para una única expresión regular, o como un array de expresiones regulares. O, opcionalmente, pase NULL para saltar la búsquda.

format

El formato deseado, como se configuró con una o más de las constantes APC_ITER_*.

chunk_size

El tamaño de trozo. Debe ser un valor mayor que 0. El valor predeterminado es 100.

list

El tipo a listar. Se puede pasar APC_LIST_ACTIVE o APC_LIST_DELETED.

Valores devueltos

Un object APCIterator en caso de éxito, o NULL en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de APCIterator::__construct()

<?php
foreach (new APCIterator('user''/^counter\./') as $counter) {
    echo 
"$counter[key]$counter[value]\n";
    
apc_dec($counter['key'], $counter['value']);
}
?>

Ver también

  • apc_exists() - Comprobar si existe una clave de APC
  • apc_cache_info() - Recupera información que hay en caché del almacén de datos de APC


APCIterator::current> <APCIterator
[edit] Last updated: Fri, 24 May 2013
 
add a note add a note User Contributed Notes APCIterator::__construct - [3 notes]
up
0
petabyte
1 year ago
With MAMP (using PHP 5.3.5 and APC 3.1.7) passing an array with multiple regex strings as $search arg always yields an empty APCIterator. Whereas passing a single string regex works. (Note: I only tried cache type 'user'.)

Workaround: Concatenated all regexes to single one with alternation. Example:

<?php
$results
= new APCIterator('user', '/^('.implode('|', $patterns).')');
?>
up
0
rodney dot rehm at medialize dot de
1 year ago
new APCIterator('file'); only lists the files loaded within the current process-scope. It is thus not possible to check if a given file already resides in the op-code cache.
(PHP5.3.6 APC3.1.9)
up
0
Anti Veeranna
2 years ago
Iterating (and specifically using current()) does not expunge cache entries for which $ttl has passed, you need to use apc_fetch to get rid of stale entries.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites