ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilXcache.php
Go to the documentation of this file.
1<?php
2require_once('./Services/GlobalCache/classes/class.ilGlobalCacheService.php');
3
11
12 const MIN_MEMORY = 32;
13
14
20 public function exists($key) {
21 return xcache_isset($this->returnKey($key));
22 }
23
24
32 public function set($key, $serialized_value, $ttl = NULL) {
33 return xcache_set($this->returnKey($key), $serialized_value, $ttl);
34 }
35
36
42 public function get($key) {
43 return xcache_get($this->returnKey($key));
44 }
45
46
52 public function delete($key) {
53 return xcache_unset($this->returnKey($key));
54 }
55
56
60 public function flush() {
61 $_SERVER["PHP_AUTH_USER"] = "xcache";
62 $_SERVER["PHP_AUTH_PW"] = "xcache";
63
64 xcache_clear_cache(XC_TYPE_VAR, 0);
65
66 return true;
67 }
68
69
75 public function serialize($value) {
76 return serialize($value);
77 }
78
79
85 public function unserialize($serialized_value) {
86 return unserialize($serialized_value);
87 }
88
89
93 protected function getActive() {
94 $function_exists = function_exists('xcache_set');
95 $var_size = ini_get('xcache.var_size') != '0M';
96 $var_count = ini_get('xcache.var_count') > 0;
97 $api = (php_sapi_name() !== 'cli');
98
99 $active = $function_exists AND $var_size AND $var_count AND $api;
100
101 return $active;
102 }
103
104
108 protected function getInstallable() {
109 return function_exists('xcache_set');
110 }
111
112
116 public function getInfo() {
117 if ($this->isActive()) {
118 return xcache_info(XC_TYPE_VAR, 0);
119 }
120 }
121
122
126 protected function getMemoryLimit() {
127 return ini_get('xcache.var_size');
128 }
129
130
134 protected function getMinMemory() {
135 return self::MIN_MEMORY;
136 }
137}
138
139?>
Class ilGlobalCacheService.
Class ilXcache.
const MIN_MEMORY
serialize($value)
exists($key)
unserialize($serialized_value)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']