To delete all variables from the data store with keys starting with a particular $prefix, do this.
<?php
foreach ( new APCUIterator( '/^' . preg_quote( $prefix, '/' ) . '/', APC_ITER_KEY ) as $item ) {
apcu_delete( $item['key'] );
}
?>
It is good practice to choose a distinctive prefix for all key names. Some server configurations cause multiple domains' code to share one APCu cache, and distinctive prefixes prevent cache variable name collisions.