ILIAS  release_8 Revision v8.24
ilApc 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 ilApc:
+ Collaboration diagram for ilApc:

Public Member Functions

 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)
 
 getInfo ()
 
 isValid (string $key)
 Checks whether the cache key is valid or not. More...
 
- 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...
 
 unserialize ($serialized_value)
 
 get (string $key)
 
 set (string $key, $serialized_value, int $ttl=null)
 
 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 ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 @inheritDoc More...
 
- Protected Member Functions inherited from ilGlobalCacheService
 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
 checkMemory ()
 

Private Attributes

const MIN_MEMORY = 16
 

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 = ''
 
- Static Protected Attributes inherited from ilGlobalCacheService
static array $active = array()
 
static array $installable = array()
 

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 ilApc @beta

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.ilApc.php.

Member Function Documentation

◆ delete()

ilApc::delete ( string  $key)
Returns
bool|string[]

Reimplemented from ilGlobalCacheService.

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

56 : bool
57 {
58 return apcu_delete($this->returnKey($key));
59 }
string $key
Consumer key/client ID value.
Definition: System.php:193

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ exists()

ilApc::exists ( string  $key)

Reimplemented from ilGlobalCacheService.

Definition at line 32 of file class.ilApc.php.

32 : bool
33 {
34 if (function_exists('apcu_exists')) {
35 return apcu_exists($this->returnKey($key));
36 }
37 return (bool) apcu_fetch($this->returnKey($key));
38 }

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ flush()

ilApc::flush ( bool  $complete = false)

Reimplemented from ilGlobalCacheService.

Definition at line 61 of file class.ilApc.php.

61 : bool
62 {
63 // incomplete flushing is not supported by APCu, an own implementation coused issues like https://mantis.ilias.de/view.php?id=28201
64 return function_exists('apcu_clear_cache') && apcu_clear_cache();
65 }

◆ get()

ilApc::get ( string  $key)
Returns
mixed

Reimplemented from ilGlobalCacheService.

Definition at line 48 of file class.ilApc.php.

49 {
50 return apcu_fetch($this->returnKey($key));
51 }

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ getActive()

ilApc::getActive ( )
protected

Reimplemented from ilGlobalCacheService.

Definition at line 115 of file class.ilApc.php.

115 : bool
116 {
117 return function_exists('apcu_store');
118 }

◆ getInfo()

ilApc::getInfo ( )

Reimplemented from ilGlobalCacheService.

Definition at line 85 of file class.ilApc.php.

85 : array
86 {
87 $return = array();
88
89 $cache_info = apc_cache_info();
90
91 unset($cache_info['cache_list']);
92 unset($cache_info['slot_distribution']);
93
94 $return['__cache_info'] = array(
95 'apc.enabled' => ini_get('apc.enabled'),
96 'apc.shm_size' => ini_get('apc.shm_size'),
97 'apc.shm_segments' => ini_get('apc.shm_segments'),
98 'apc.gc_ttl' => ini_get('apc.gc_ttl'),
99 'apc.user_ttl' => ini_get('apc.ttl'),
100 'info' => $cache_info,
101 );
102
103 $cache_info = apc_cache_info();
104 foreach ($cache_info['cache_list'] as $dat) {
105 $key = $dat['key'];
106
107 if (preg_match('/' . $this->getServiceId() . '_' . $this->getComponent() . '/', $key)) {
108 $return[$key] = apc_fetch($key);
109 }
110 }
111
112 return $return;
113 }

References ILIAS\LTI\ToolProvider\$key, ilGlobalCacheService\getComponent(), and ilGlobalCacheService\getServiceId().

+ Here is the call graph for this function:

◆ getInstallable()

ilApc::getInstallable ( )
protected

Reimplemented from ilGlobalCacheService.

Definition at line 120 of file class.ilApc.php.

120 : bool
121 {
122 return function_exists('apcu_store');
123 }

◆ getMemoryLimit()

ilApc::getMemoryLimit ( )
protected

Reimplemented from ilGlobalCacheService.

Definition at line 125 of file class.ilApc.php.

125 : string
126 {
127 if (ilRuntime::getInstance()->isHHVM()) {
128 return $this->getMinMemory() . 'M';
129 }
130
131 return ini_get('apc.shm_size');
132 }
getMinMemory()
@inheritDoc
static getInstance()

References ilRuntime\getInstance(), and getMinMemory().

+ Here is the call graph for this function:

◆ getMinMemory()

ilApc::getMinMemory ( )
protected

@inheritDoc

Reimplemented from ilGlobalCacheService.

Definition at line 137 of file class.ilApc.php.

137 : int
138 {
139 return self::MIN_MEMORY;
140 }
const MIN_MEMORY
Definition: class.ilApc.php:30

References MIN_MEMORY.

Referenced by getMemoryLimit().

+ Here is the caller graph for this function:

◆ isValid()

ilApc::isValid ( string  $key)

Checks whether the cache key is valid or not.

Reimplemented from ilGlobalCacheService.

Definition at line 145 of file class.ilApc.php.

145 : bool
146 {
147 return true;
148 }

◆ serialize()

ilApc::serialize (   $value)
Parameters
mixed$value
Returns
mixed|string

Reimplemented from ilGlobalCacheService.

Definition at line 71 of file class.ilApc.php.

72 {
73 return ($value);
74 }

◆ set()

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

Reimplemented from ilGlobalCacheService.

Definition at line 40 of file class.ilApc.php.

40 : bool
41 {
42 return apcu_store($this->returnKey($key), $serialized_value, $ttl);
43 }

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ unserialize()

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

Reimplemented from ilGlobalCacheService.

Definition at line 80 of file class.ilApc.php.

81 {
82 return ($serialized_value);
83 }

Field Documentation

◆ MIN_MEMORY

const ilApc::MIN_MEMORY = 16
private

Definition at line 30 of file class.ilApc.php.

Referenced by getMinMemory().


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