[Solar-svn] Revision 3167

pmjones at solarphp.com pmjones at solarphp.com
Sat May 17 17:13:22 CDT 2008


Solar_Sql_Model_Cache: [CHG] Cache entries are now keyed under "model/$model_name", not "table/$table_name".  This helps reduce cache clearing with single-table-inheritance models.


Modified: trunk/Solar/Sql/Model/Cache.php
===================================================================
--- trunk/Solar/Sql/Model/Cache.php	2008-05-17 22:09:14 UTC (rev 3166)
+++ trunk/Solar/Sql/Model/Cache.php	2008-05-17 22:13:22 UTC (rev 3167)
@@ -112,7 +112,7 @@
      * Technically, this just increases the data version number.  This means
      * that older versions will no longer be valid, causing a cache miss.
      * 
-     * The version entry is keyed under `$prefix/table/$table/data_version`.
+     * The version entry is keyed under `$prefix/model/$model_name/data_version`.
      * 
      * @return void
      * 
@@ -120,8 +120,8 @@
     public function delete()
     {
         $key = $this->_prefix
-             . "/table"
-             . "/{$this->_model->table_name}"
+             . "/model"
+             . "/{$this->_model->model_name}"
              . "/data_version";
         
         $this->_cache->increment($key);
@@ -147,7 +147,7 @@
      * 
      * Gets the key for a cache entry based on fetch parameters for a select.
      * 
-     * The entry is keyed under `$prefix/table/$table/data/$version/$hash`,
+     * The entry is keyed under `$prefix/model/$model_name/data/$version/$hash`,
      * where $hash is an MD5 hash of the serialized parameters.
      * 
      * If the params include a `cache_key` entry, that value is used instead
@@ -167,13 +167,14 @@
         } else {
             unset($params['cache']);
             unset($params['cache_key']);
+            unset($params['count_pages']);
             $serial = serialize($params);
             $key = hash('md5', $serial);
         }
         
         $key = $this->_prefix
-             . "/table"
-             . "/{$this->_model->table_name}"
+             . "/model"
+             . "/{$this->_model->model_name}"
              . "/data"
              . "/$version"
              . "/$key";
@@ -221,7 +222,7 @@
      * 
      * Fetches the current model data version from the cache.
      * 
-     * The entry is keyed under `$prefix/table/$table/data_version`.
+     * The entry is keyed under `$prefix/model/$model_name/data_version`.
      * 
      * @return int The model data version.
      * 
@@ -229,8 +230,8 @@
     protected function _fetchVersion()
     {
         $key = $this->_prefix
-             . "/table"
-             . "/{$this->_model->table_name}"
+             . "/model"
+             . "/{$this->_model->model_name}"
              . "/data_version";
         
         $result = $this->_cache->fetch($key);




More information about the Solar-svn mailing list