ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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) {
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 ?>