Work on performance improvements with caching

This commit is contained in:
Deon George
2012-12-04 11:52:10 +11:00
parent eafb80f7fc
commit 1bf8a520e2
30 changed files with 877 additions and 495 deletions

View File

@@ -51,16 +51,15 @@ abstract class TSM_ORM extends ORM {
public function __get($column) {
// Get a substited column name - need for DB2/DSMADMC schema differences
if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate'])) {
if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate']))
return is_null($c=$this->_tsm[$this->_db_group]['translate'][$column]) ? NULL : parent::__get($c);
}
else
return parent::__get($column);
}
public function find() {
// Check if we can preload our data and havent already done it
if ($time = $this->isCacheable() AND is_null(Cache::instance()->get($cache_key = 'PRELOAD:'.$this->_table_name))) {
if ($time = $this->isCacheable() AND is_null(Cache::instance(Kohana::$config->load('config')->cache)->get($cache_key = 'PRELOAD:'.$this->_table_name))) {
// Firstly set our cache, so that we dont get in a loop
Cache::instance()->set($cache_key,TRUE,$time-1);