From a658e314697e0b9e529a73df25edf4fffaf2b519 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 6 Oct 2006 01:29:36 +0000 Subject: --- system/database/DB_driver.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 403255799..f77b46609 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -51,6 +51,7 @@ class CI_DB_driver { var $_trans_failure = FALSE; // Used with transactions to determine if a rollback should occur var $cache_on = FALSE; var $cachedir = ''; + var $cache_autodel = TRUE; var $CACHE; // The cache class object @@ -287,7 +288,7 @@ class CI_DB_driver { { // If caching is enabled we'll auto-cleanup any // existing files related to this particular URI - if ($this->cache_on == TRUE AND $this->_cache_init()) + if ($this->cache_on == TRUE AND $this->cache_autodel == TRUE AND $this->_cache_init()) { $this->CACHE->delete(); } @@ -331,6 +332,10 @@ class CI_DB_driver { $CR->num_rows = $RES->num_rows(); $CR->result_object = $RES->result_object(); $CR->result_array = $RES->result_array(); + + // Reset these since cached objects can not utilize resource IDs. + $CR->conn_id = NULL; + $CR->result_id = NULL; $this->CACHE->write($sql, $CR); } @@ -910,6 +915,19 @@ class CI_DB_driver { { return $this->cache_on = FALSE; } + + // -------------------------------------------------------------------- + + /** + * Set the cache "auto-delete" value + * + * @access public + * @return void + */ + function cache_autodelete($val = TRUE) + { + $this->cache_autodel = ( ! is_bool($val)) ? TRUE : $val; + } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b