[pLog-svn] r2503 - plog/trunk/class/dao

oscar at devel.plogworld.net oscar at devel.plogworld.net
Wed Sep 21 19:16:19 GMT 2005


Author: oscar
Date: 2005-09-21 19:16:18 +0000 (Wed, 21 Sep 2005)
New Revision: 2503

Modified:
   plog/trunk/class/dao/mylinks.class.php
   plog/trunk/class/dao/mylinkscategories.class.php
Log:
fixed several issues with the cache


Modified: plog/trunk/class/dao/mylinks.class.php
===================================================================
--- plog/trunk/class/dao/mylinks.class.php	2005-09-20 19:17:02 UTC (rev 2502)
+++ plog/trunk/class/dao/mylinks.class.php	2005-09-21 19:16:18 UTC (rev 2503)
@@ -78,12 +78,8 @@
 			
 			if( $result ) {
 				// clean the cache
-				/**
-				 * :TODO:
-				 * this doesn't seem to work very well!!!
-				 */
                 $this->_cache->removeData( $myLink->getId(), CACHE_MYLINKS );
-                $this->_cache->removeData( "all", CACHE_MYLINKS_ALL );			
+                $this->_cache->removeData( $myLink->getBlogId(), CACHE_MYLINKS_ALL );			
 				// mark the corresponding link categories as modified now
 				$linkCategories = new MyLinksCategories();
 				$category = $myLink->getMyLinkCategory();

Modified: plog/trunk/class/dao/mylinkscategories.class.php
===================================================================
--- plog/trunk/class/dao/mylinkscategories.class.php	2005-09-20 19:17:02 UTC (rev 2502)
+++ plog/trunk/class/dao/mylinkscategories.class.php	2005-09-21 19:16:18 UTC (rev 2503)
@@ -62,6 +62,8 @@
 				$order = Array( "last_modification" => "ASC" );
 			elseif( $order == MYLINKS_CATEGORIES_LAST_UPDATED_LAST )
 				$order = Array( "last_modification" => "ASC" );
+			else
+				$order = Array();
 			
             $blogCategories = $this->getMany( "blog_id", 
                                              $blogId,
@@ -86,7 +88,7 @@
         function addMyLinksCategory( &$myLinksCategory )
         {
         	if(( $result = $this->add( $myLinksCategory, Array( CACHE_MYLINKCATEGORIES => "getId" )))) {
-        		$this->_cache->removeData( "all", CACHE_MYLINKCATEGORIES_ALL );
+        		$this->_cache->removeData( $myLinksCategory->getBlogId(), CACHE_MYLINKCATEGORIES_ALL );
         	}
         	
         	return( $result );
@@ -104,8 +106,8 @@
         	$category = $this->getMyLinksCategory( $categoryId, $blogId );
         	if( $category ) {
         		if( $this->delete( "id", $categoryId )) {
-        			$this->_cache->removeData( $category->getId(), CACHE_MYLINKSCATEGORIES );
-        			$this->_cache->removeData( "all", CACHE_MYLINKSCATEGORIES_ALL );
+        			$this->_cache->removeData( $category->getId(), CACHE_MYLINKCATEGORIES );
+        			$this->_cache->removeData( "all", CACHE_MYLINKCATEGORIES_ALL );
         		}
         	}
         	else
@@ -136,7 +138,7 @@
          */
         function getMyLinksCategory( $categoryId, $blogId = 0 )
         {
-        	$myLinksCategory = $this->get( "id", $categoryId, CACHE_MYLINKSCATEGORIES );
+        	$myLinksCategory = $this->get( "id", $categoryId, CACHE_MYLINKCATEGORIES );
         	if( $blogId > 0 && $myLinksCategory->getBlogId() != $blogId )
         		return false;
 
@@ -152,8 +154,8 @@
         function updateMyLinksCategory( $category )
         {
         	if( ($result = $this->update( $category ))) {
-        		$this->_cache->setData( $category->getId(), CACHE_MYLINKSCATEGORIES, $category );
-        		$this->_cache->removeData( "all", CACHE_MYLINKSCATEGORIES_ALL );
+        		$this->_cache->removeData( $category->getId(), CACHE_MYLINKCATEGORIES );
+        		$this->_cache->removeData( $category->getBlogId(), CACHE_MYLINKCATEGORIES_ALL );
         	}
         	
         	return( $result );
@@ -208,6 +210,9 @@
 				return false;
 		}
 		
+		/**
+		 * @private
+		 */
 		function mapRow( $row )
 		{
         	$myLinksCategory = new MyLinksCategory( $row["name"],




More information about the pLog-svn mailing list