ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilShm.php
Go to the documentation of this file.
1 <?php
2 
3 require_once('./Services/GlobalCache/classes/class.ilGlobalCacheService.php');
4 
14 {
15 
19  protected static $shm_id = null;
23  protected static $block_size = 0;
24 
25 
29  protected function getActive()
30  {
31  self::$active = function_exists('shmop_open');
32  }
33 
34 
38  protected function getInstallable()
39  {
40  return false;
41  self::$active = function_exists('shmop_open');
42  }
43 
44 
50  {
51  parent::__construct($service_id, $component);
52  self::$shm_id = shmop_open(0xff3, "c", 0644, 100);
53  self::$block_size = shmop_size(self::$shm_id);
54  }
55 
56 
62  public function exists($key)
63  {
64  return shm_has_var(self::$shm_id, $key);
65  }
66 
67 
75  public function set($key, $serialized_value, $ttl = null)
76  {
77  return shmop_write(self::$shm_id, $key, $serialized_value);
78  }
79 
80 
86  public function get($key)
87  {
88  return shmop_read(self::$shm_id, 0, self::$block_size);
89  }
90 
91 
97  public function delete($key)
98  {
99  return shm_remove_var(self::$shm_id, $key);
100  }
101 
102 
106  public function flush()
107  {
108  shmop_delete(self::$id);
109 
110  return true;
111  }
112 
113 
119  public function serialize($value)
120  {
121  return serialize($value);
122  }
123 
124 
130  public function unserialize($serialized_value)
131  {
132  return unserialize($serialized_value);
133  }
134 }
unserialize($serialized_value)
if(!array_key_exists('StateId', $_REQUEST)) $id
Class ilGlobalCacheService.
exists($key)
Definition: class.ilShm.php:62
getActive()
set self::$active
Definition: class.ilShm.php:29
static $block_size
Definition: class.ilShm.php:23
Class ilShm.
Definition: class.ilShm.php:13
static $shm_id
Definition: class.ilShm.php:19
getInstallable()
set self::$installable
Definition: class.ilShm.php:38
serialize($value)
__construct($service_id, $component)
Definition: class.ilShm.php:49
$key
Definition: croninfo.php:18