ILIAS  release_8 Revision v8.23
ilShm Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilShm:
+ Collaboration diagram for ilShm:

Public Member Functions

 __construct (string $service_id, string $component)
 ilShm constructor. More...
 
 exists (string $key)
 
 set (string $key, $serialized_value, int $ttl=null)
 
 get (string $key)
 
 delete (string $key)
 
 flush (bool $complete=false)
 
 serialize ($value)
 
 unserialize ($serialized_value)
 
- Public Member Functions inherited from ilGlobalCacheService
 __construct (string $service_id, string $component)
 ilGlobalCacheService constructor. More...
 
 unserialize ($serialized_value)
 
 get (string $key)
 
 set (string $key, $serialized_value, int $ttl=null)
 
 serialize ($value)
 
 getServiceId ()
 
 setServiceId (string $service_id)
 
 getComponent ()
 
 setComponent (string $component)
 
 isActive ()
 
 isInstallable ()
 
 returnKey (string $key)
 
 getInfo ()
 
 getInstallationFailureReason ()
 
 exists (string $key)
 
 delete (string $key)
 
 flush (bool $complete=false)
 
 setServiceType (int $service_type)
 
 getServiceType ()
 
 setValid (string $key)
 Declare a key as valid. More...
 
 isValid (string $key)
 Checks whether the cache key is valid or not. More...
 

Protected Member Functions

 getActive ()
 set self::$active More...
 
 getInstallable ()
 set self::$installable More...
 
- Protected Member Functions inherited from ilGlobalCacheService
 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
 checkMemory ()
 

Static Protected Attributes

static int $shm_id
 
static int $block_size = 0
 
- Static Protected Attributes inherited from ilGlobalCacheService
static array $active = array()
 
static array $installable = array()
 

Additional Inherited Members

- Protected Attributes inherited from ilGlobalCacheService
int $current_time = 0
 
array $valid_keys = array()
 
string $service_id = ''
 
string $component = ''
 
int $service_type = ilGlobalCache::TYPE_STATIC
 
string $valid_key_hash = ''
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilShm http://php.net/manual/en/shmop.examples-basic.php

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 25 of file class.ilShm.php.

Constructor & Destructor Documentation

◆ __construct()

ilShm::__construct ( string  $service_id,
string  $component 
)

ilShm constructor.

Definition at line 49 of file class.ilShm.php.

References ILIAS\GlobalScreen\Provider\__construct().

50  {
52  self::$shm_id = shmop_open(0xff3, "c", 0644, 100);
53  self::$block_size = shmop_size(self::$shm_id);
54  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilShm::delete ( string  $key)

Implements ilGlobalCacheServiceInterface.

Definition at line 73 of file class.ilShm.php.

73  : bool
74  {
75  return shm_remove_var(self::$shm_id, $key);
76  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ exists()

ilShm::exists ( string  $key)

Implements ilGlobalCacheServiceInterface.

Definition at line 56 of file class.ilShm.php.

56  : bool
57  {
58  return shm_has_var(self::$shm_id, $key);
59  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ flush()

ilShm::flush ( bool  $complete = false)

Implements ilGlobalCacheServiceInterface.

Definition at line 78 of file class.ilShm.php.

78  : bool
79  {
80  // currently a partial flushing is missing
81  shmop_delete(self::$shm_id);
82 
83  return true;
84  }

◆ get()

ilShm::get ( string  $key)
Returns
mixed

Implements ilGlobalCacheServiceInterface.

Definition at line 68 of file class.ilShm.php.

69  {
70  return shmop_read(self::$shm_id, 0, self::$block_size);
71  }

◆ getActive()

ilShm::getActive ( )
protected

set self::$active

Definition at line 33 of file class.ilShm.php.

33  : bool
34  {
35  return function_exists('shmop_open');
36  }

◆ getInstallable()

ilShm::getInstallable ( )
protected

set self::$installable

Definition at line 41 of file class.ilShm.php.

41  : bool
42  {
43  return false;
44  }

◆ serialize()

ilShm::serialize (   $value)
Parameters
mixed$value

Definition at line 89 of file class.ilShm.php.

89  : string
90  {
91  return serialize($value);
92  }
serialize($value)
Definition: class.ilShm.php:89

◆ set()

ilShm::set ( string  $key,
  $serialized_value,
int  $ttl = null 
)
Parameters
mixed$serialized_value

Implements ilGlobalCacheServiceInterface.

Definition at line 62 of file class.ilShm.php.

62  : bool
63  {
64  return (bool) shmop_write(self::$shm_id, $key, $serialized_value);
65  }
string $key
Consumer key/client ID value.
Definition: System.php:193

◆ unserialize()

ilShm::unserialize (   $serialized_value)
Parameters
mixed$serialized_value
Returns
mixed

Implements ilGlobalCacheServiceInterface.

Definition at line 98 of file class.ilShm.php.

99  {
100  return unserialize($serialized_value);
101  }
unserialize($serialized_value)
Definition: class.ilShm.php:98

Field Documentation

◆ $block_size

int ilShm::$block_size = 0
staticprotected

Definition at line 28 of file class.ilShm.php.

◆ $shm_id

int ilShm::$shm_id
staticprotected

Definition at line 27 of file class.ilShm.php.


The documentation for this class was generated from the following file: