<?php error_reporting(E_ALL & ~E_USER_NOTICE & ~E_NOTICE); echo "== No Search ==\n"; $it = new APCIterator('user'); apc_store('sample', 'x'); apc_store('another_sample', 'x'); foreach ($it as $key => $val) { // skip to end } var_dump($it->valid(), $it->key(), $it->current(), $it->next()); echo "== Search ==\n"; $it = new APCIterator('user', '/^b/'); // No elements, end? var_dump($it->valid(), $it->key(), $it->current(), $it->next());
/** * Get current key * * @return string */ public function key() { $key = $this->baseIterator->key(); // remove namespace prefix return substr($key, $this->prefixLength); }
/** * @param string $className * @depreciated */ public function clearClassCache($className = null) { $iterator = new \APCIterator('^user^'); while ($iterator->current()) { $tKey = $iterator->key(); if (mb_strpos($tKey, $className . '::') !== false) { apc_delete($tKey); } $iterator->next(); } }