ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilShm.php
Go to the documentation of this file.
1 <?php
2 
3 require_once('./Services/GlobalCache/classes/class.ilGlobalCacheService.php');
4 
13 class ilShm extends ilGlobalCacheService {
14 
18  protected static $shm_id = null;
22  protected static $block_size = 0;
23 
24 
28  protected function getActive() {
29  self::$active = function_exists('shmop_open');
30  }
31 
32 
36  protected function getInstallable() {
37  return false;
38  self::$active = function_exists('shmop_open');
39  }
40 
41 
46  public function __construct($service_id, $component) {
47  parent::__construct($service_id, $component);
48  self::$shm_id = shmop_open(0xff3, "c", 0644, 100);
49  self::$block_size = shmop_size(self::$shm_id);
50  }
51 
52 
58  public function exists($key) {
59  return shm_has_var(self::$shm_id, $key);
60  }
61 
62 
70  public function set($key, $serialized_value, $ttl = null) {
71  return shmop_write(self::$shm_id, $key, $serialized_value);
72  }
73 
74 
80  public function get($key) {
81  return shmop_read(self::$shm_id, 0, self::$block_size);
82  }
83 
84 
90  public function delete($key) {
91  return shm_remove_var(self::$shm_id, $key);
92  }
93 
94 
98  public function flush() {
99  shmop_delete(self::$id);
100 
101  return true;
102  }
103 
104 
110  public function serialize($value) {
111  return serialize($value);
112  }
113 
114 
120  public function unserialize($serialized_value) {
121  return unserialize($serialized_value);
122  }
123 }
124 
125 ?>
unserialize($serialized_value)
Class ilGlobalCacheService.
exists($key)
Definition: class.ilShm.php:58
getActive()
set self::$active
Definition: class.ilShm.php:28
static $block_size
Definition: class.ilShm.php:22
Class ilShm.
Definition: class.ilShm.php:13
static $shm_id
Definition: class.ilShm.php:18
getInstallable()
set self::$installable
Definition: class.ilShm.php:36
serialize($value)
__construct($service_id, $component)
Definition: class.ilShm.php:46