From f439fe96c81930d0b7d43c02a3108fd15c17715e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 14 May 2009 01:19:05 +0000 Subject: Overload ORM_Iterator to cache models as we pull them out of the result set. This allows us to see the cache and avoid further lookups. --- core/helpers/model_cache.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/helpers') diff --git a/core/helpers/model_cache.php b/core/helpers/model_cache.php index d8158902..f4b11a6e 100644 --- a/core/helpers/model_cache.php +++ b/core/helpers/model_cache.php @@ -31,4 +31,10 @@ class model_cache_Core { return self::$cache->$model_name->$field_name->$id; } + + static function set($model) { + self::$cache->{$model->object_name} + ->{$model->primary_key} + ->{$model->{$model->primary_key}} = $model; + } } -- cgit v1.2.3