var : false; } /** * Deletes the data associated with key $key. Returns true or false depending * on the success of the operation. * * @param string $key * @return bool */ public function delete( $key ) { return apc_delete( $key ); } /** * Resets the complete backend. * * Marked private to not expose more of this interface to the user, since * this will be removed in future versions. * * @return void * @access private */ public function reset() { // Kills the whole user cache apc_clear_cache( "user" ); } /** * Acquires a lock on the given $key. * * @param string $key * @param int $waitTime usleep() * @param int $maxTime seconds */ public function acquireLock( $key, $waitTime, $maxTime ) { $counter = 0; // add() does not replace and returns true on success. $maxTime is // obeyed by Memcache expiry. while ( apc_add( $key, time(), $maxTime ) === false ) { // Wait for next check usleep( $waitTime ); // Don't check expiry time too frquently, since it requires restoring if ( ( ++$counter % 10 === 0 ) && ( time() - (int)apc_fetch( $key ) > $maxTime ) ) { // Release expired lock and place own lock apc_store( $key, time(), $maxTime ); break; } } } /** * Releases a lock on the given $key. * * @param string $key * @return void */ public function releaseLock( $key ) { apc_delete( $key ); } } ?>