--- cacherouter/engines/memcache.php	2009-09-05 15:03:25.000000000 +0200
+++ cacherouter/engines/memcache.php	2011-02-25 16:13:00.000000000 +0100
@@ -113,16 +113,16 @@
     if (substr($key, strlen($key) - 1, 1) == '*') {
       $key = $this->key(substr($key, 0, strlen($key) - 1));
       if ($this->settings['shared']) {
-        $lookup = $this->memcache->get($this->lookup);
-        if (!empty($lookup)) {
-          foreach ($lookup as $k => $v) {
-            if (substr($k, 0, strlen($key)) == $key) {
-              $this->memcache->delete($k);
-              unset($lookup[$k]);
+        if ($this->lock()) {
+          $lookup = $this->memcache->get($this->lookup);
+          if (!empty($lookup)) {
+            foreach ($lookup as $k => $v) {
+              if (substr($k, 0, strlen($key)) == $key) {
+                $this->memcache->delete($k);
+                unset($lookup[$k]);
+              }
             }
           }
-        }
-        if ($this->lock()) {
           $this->memcache->set($this->lookup, $lookup, FALSE, 0); 
           $this->unlock();
         }
