diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-01-14 03:22:17 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-01-14 03:22:17 +0000 |
commit | 383ec9c22cde58a15d48ddad18377d4f99348e91 (patch) | |
tree | 851af67858ec9c6070f4e310e88514775d628b33 /core/helpers | |
parent | 7305026fd8a914bd91df9119d995c732894af1b6 (diff) |
Initialize the model_cache:: as an array and use sub arrays to maintain the cache
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/model_cache.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/helpers/model_cache.php b/core/helpers/model_cache.php index 0fea8b75..e508ff16 100644 --- a/core/helpers/model_cache.php +++ b/core/helpers/model_cache.php @@ -18,17 +18,17 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class model_cache_Core { - private static $cache; + private static $cache = array(); static function get($model_name, $id, $field_name="id") { - if (TEST_MODE || empty(self::$cache->$model_name->$field_name->$id)) { + if (TEST_MODE || empty(self::$cache[$model_name][$field_name][$id])) { $model = ORM::factory($model_name)->where($field_name, $id)->find(); if (!$model->loaded) { throw new Exception("@todo MISSING_MODEL $model_name:$id"); } - self::$cache->$model_name->$field_name->$id = $model; - } + self::$cache[$model_name][$field_name][$id] = $model; - return self::$cache->$model_name->$field_name->$id; + } + return self::$cache[$model_name][$field_name][$id]; } } |