用通配符清除apcu

Is it possible to clear apcu cache using a wild card?

For instance I may have a bunch of cache keys:

products_fooandbars product_1_foo

users_fooandbars user_1_foo user_1_bar

user_2_foo user_2_bar

Is there a way to clear everything that user 1 has like this user_1_* or clear all the user's like this user_*

I'm using Symfony with the doctrine apc cache classes

OP refers to APCu not APC.
There isn't much difference in function names, etc, but it's best for anyone to make clear that APC is the old version, and APCu is the new one, with a much better implementation.

Old APC implements both opcode cache and user object cache. APCu only implements user object cache. For opcode cache you use something else, like Zend OPcache. That said, here's an updated version from @Evgenly's:

// delete all keys beginning with a regex match
foreach(new APCUIterator('/^MY_KEY/') as $apcu_cache){
    echo 'key: ' . $apcu_cache['key'] . PHP_EOL;
    echo 'val: ' . $apcu_cache['value'];
    apcu_delete($apcu_cache['key']); 
}

The foreach is illustrative, you can also do:

apcu_delete(new APCUIterator('/^MY_KEY/'));

I believe you should try as it was described http://php.net/manual/en/function.apc-delete.php#101794

// delete all keys beginning with a regex match on MY_APC_TESTA
$toDelete = new APCIterator('user', '/^MY_KEY/', APC_ITER_VALUE);

var_dump( apc_delete($toDelete) );