ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
108  public function flush($complete = false)
109  {
110  // currently a partial flushing is missing
111  shmop_delete(self::$shm_id);
112 
113  return true;
114  }
115 
116 
122  public function serialize($value)
123  {
124  return serialize($value);
125  }
126 
127 
133  public function unserialize($serialized_value)
134  {
135  return unserialize($serialized_value);
136  }
137 }
unserialize($serialized_value)
Class ilGlobalCacheService.
flush($complete=false)
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