diff --git a/include/class.orm.php b/include/class.orm.php index 75078e272ecab101ac68b0135b4937a135c9e90d..818d33be9e8fbe474a588ec0b1660678a816a4e7 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -141,7 +141,20 @@ class ModelMeta implements ArrayAccess { } function inspectFields() { - return DbEngine::getCompiler()->inspectTable($this['table']); + static $cache; + if (!isset($cache)) + $cache = function_exists('apc_fetch'); + if ($cache) { + $key = md5(SECRET_SALT . GIT_VERSION . $this['table']); + if ($fields = apc_fetch($key)) { + return $fields; + } + } + $fields = DbEngine::getCompiler()->inspectTable($this['table']); + if ($cache) { + apc_store($key, $fields); + } + return $fields; } }