diff --git a/lib/cache/cache.inc.php b/lib/cache/cache.inc.php new file mode 100644 index 0000000..1da4706 --- /dev/null +++ b/lib/cache/cache.inc.php @@ -0,0 +1,67 @@ +bEnabled = $oKTConfig->get('cache/cacheEnabled', false); + if (empty($this->bEnabled)) { + return; + } + + $aOptions['cacheDir'] = $oKTConfig->get('cache/cacheDirectory') . "/"; + $user = KTLegacyLog::running_user(); + if ($user) { + $aOptions['cacheDir'] .= $user . '/'; + } + if (!file_exists($aOptions['cacheDir'])) { + mkdir($aOptions['cacheDir']); + } + $aOptions['lifeTime'] = 60; + $aOptions['memoryCaching'] = true; + $aOptions['automaticSerialization'] = true; + $this->oLite =& new Cache_Lite($aOptions); + } + + function get($group, $id) { + if (empty($this->bEnabled)) { + return false; + } + return $this->oLite->get($id, strtolower($group)); + } + + function set($group, $id, $val) { + if (empty($this->bEnabled)) { + return false; + } + return $this->oLite->save($val, $id, strtolower($group)); + } + + function remove($group, $id) { + if (empty($this->bEnabled)) { + return false; + } + return $this->oLite->remove($id, strtolower($group)); + } + + function clear($group) { + if (empty($this->bEnabled)) { + return false; + } + return $this->oLite->clean(strtolower($group)); + } +} + +?>