From 57b109dc2b8845eeb5f68881aea08cebb4aa6b42 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 18 Mar 2016 10:07:17 -0500 Subject: [PATCH] orm: Add TTL to APCu cache stores --- include/class.orm.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/class.orm.php b/include/class.orm.php index 92d2c6b0f..8764ba73f 100644 --- a/include/class.orm.php +++ b/include/class.orm.php @@ -110,7 +110,7 @@ class ModelMeta implements ArrayAccess { $this->meta = $meta; if (function_exists('apcu_store')) { - apcu_store($apc_key, $this->meta); + apcu_store($apc_key, $this->meta, 1800); } } @@ -255,16 +255,16 @@ class ModelMeta implements ArrayAccess { function inspectFields() { if (!isset(self::$model_cache)) - self::$model_cache = function_exists('apc_fetch'); + self::$model_cache = function_exists('apcu_fetch'); if (self::$model_cache) { - $key = md5(SECRET_SALT . GIT_VERSION . $this['table']); + $key = SECRET_SALT.GIT_VERSION."/orm/{$this['table']}"; if ($fields = apc_fetch($key)) { return $fields; } } $fields = DbEngine::getCompiler()->inspectTable($this['table']); if (self::$model_cache) { - apc_store($key, $fields); + apcu_store($key, $fields, 1800); } return $fields; } -- GitLab