mythinking / doophp

Automatically exported from code.google.com/p/doophp
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Memcache objects never flushed [patch fix included] #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use Doo::cache('memcache')->set() to store object X
2. Use DooSmartModel::update() to update object X, which should purge the cache
3. Find object X, getting the old cached version that was never purged even 
though the db was successfully updated

What is the expected output? What do you see instead?
Expected: updated object. Instead see old cached version.

What version of the product are you using? On what operating system?
latest DooPHP trunk (r644) on Mac OS X 10.6.7, PHP 5.3.1 via MacPorts, 
memcached 1.4.4 via MacPorts

Please provide any additional information below.

Simple patch fixes the issue.  Between DooSmartModel setCache and purgeCache, 
there is a mismatch in the key name that stores the list of objects of a given 
type to delete.

Index: db/DooSmartModel.php
===================================================================
--- db/DooSmartModel.php    (revision 644)
+++ db/DooSmartModel.php    (working copy)
@@ -219,7 +219,7 @@
         }
         else{
             //need to store the list of Model cache to be purged later on for Memory based cache.
-            $keysId = Doo::conf(self::$cacheMode)->SITE_PATH . 
'mdl_'.self::$className;
+            $keysId = Doo::conf(self::$cacheMode)->SITE_PATH . 
Doo::conf()->PROTECTED_PATH . 'mdl_'.self::$className;
             if($keys = Doo::cache(self::$cacheMode)->get($keysId)){
                 $listOfModelCache = $keys->getArrayCopy();
                 $listOfModelCache[] = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_PATH . $id;

Original issue reported on code.google.com by towyn...@gmail.com on 8 May 2011 at 8:56

GoogleCodeExporter commented 9 years ago

Original comment by darkredz on 16 May 2011 at 6:53

GoogleCodeExporter commented 9 years ago
Please apply this one-line fix.  Memcache is completely broken without it.

Original comment by zachary....@residentialscience.com on 2 Jul 2011 at 2:30

GoogleCodeExporter commented 9 years ago

Original comment by darkredz on 22 Jul 2011 at 6:43