Browse Source

Experimental support of APC to speed-up the application.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1143 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 years ago
parent
commit
7a1bef73f1
1 changed files with 28 additions and 0 deletions
  1. 28 0
      core/dict.class.inc.php

+ 28 - 0
core/dict.class.inc.php

@@ -231,5 +231,33 @@ class Dict
 	{
 		MyHelpers::var_dump_html(self::$m_aData);
 	}
+	
+	public static function InCache()
+	{
+		if (function_exists('apc_fetch'))
+		{
+			$bResult = false;
+			self::$m_aData = apc_fetch('dict', $bResult);
+			if (!$bResult)
+			{
+				self::$m_aData = array();
+			}
+			else
+			{
+				self::$m_aLanguages = apc_fetch('languages', $bResult);
+			}
+			return $bResult;
+		}
+		return false;
+	}
+	
+	public static function InitCache()
+	{
+		if (function_exists('apc_store'))
+		{
+			apc_store('languages', self::$m_aLanguages);
+			apc_store('dict', self::$m_aData);
+		}
+	}
 }
 ?>