ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilApc Class Reference

Class ilApc. More...

+ Inheritance diagram for ilApc:
+ Collaboration diagram for ilApc:

Public Member Functions

 exists ($key)
 
 set ($key, $serialized_value, $ttl=0)
 
 get ($key)
 
 delete ($key)
 
 flush ()
 
 serialize ($value)
 
 unserialize ($serialized_value)
 
 getInfo ()
 
- Public Member Functions inherited from ilGlobalCacheService
 __construct ($service_id, $component)
 
 __destruct ()
 
 unserialize ($serialized_value)
 
 get ($key)
 
 set ($key, $serialized_value, $ttl=NULL)
 
 serialize ($value)
 
 getServiceId ()
 
 setServiceId ($service_id)
 
 setValid ($key)
 
 getComponent ()
 
 setComponent ($component)
 
 setInvalid ($key=NULL)
 
 isValid ($key)
 
 isActive ()
 
 isInstallable ()
 
 returnKey ($key)
 
 getInfo ()
 
 getInstallationFailureReason ()
 
 exists ($key)
 
 delete ($key)
 
 flush ()
 
 setServiceType ($service_type)
 
 getServiceType ()
 

Data Fields

const MIN_MEMORY = 128
 
const CACHE_ID = 'user'
 

Protected Member Functions

 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
- Protected Member Functions inherited from ilGlobalCacheService
 saveValid ()
 
 readValid ()
 
 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
 checkMemory ()
 

Additional Inherited Members

- Protected Attributes inherited from ilGlobalCacheService
 $current_time = 0
 
 $valid_keys = array()
 
 $service_id = ''
 
 $component = ''
 
 $service_type = ilGlobalCache::TYPE_STATIC
 
 $valid_key_hash = ''
 
- Static Protected Attributes inherited from ilGlobalCacheService
static $active = array()
 
static $installable = array()
 

Detailed Description

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 14 of file class.ilApc.php.

Member Function Documentation

◆ delete()

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

Reimplemented from ilGlobalCacheService.

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

61 {
62 return apc_delete($this->returnKey($key));
63 }

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ exists()

ilApc::exists (   $key)
Parameters
$key
Returns
bool

Reimplemented from ilGlobalCacheService.

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

25 {
26 if (function_exists('apc_exists')) {
27 return apc_exists($this->returnKey($key));
28 } else {
29 return apc_fetch($this->returnKey($key)) !== NULL;
30 }
31 }

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ flush()

ilApc::flush ( )
Returns
bool

Reimplemented from ilGlobalCacheService.

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

69 {
70 return apc_clear_cache(self::CACHE_ID);
71 }

◆ get()

ilApc::get (   $key)
Parameters
$key
Returns
mixed

Reimplemented from ilGlobalCacheService.

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

51 {
52 return apc_fetch($this->returnKey($key));
53 }

References ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ getActive()

ilApc::getActive ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

127 {
128 return function_exists('apc_store');
129 }

◆ getInfo()

ilApc::getInfo ( )
Returns
array

Reimplemented from ilGlobalCacheService.

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

97 {
98 $return = array();
99
100 $cache_info = apc_cache_info();
101
102 unset($cache_info['cache_list']);
103 unset($cache_info['slot_distribution']);
104
105 $return['__cache_info'] = array(
106 'apc.enabled' => ini_get('apc.enabled'),
107 'apc.shm_size' => ini_get('apc.shm_size'),
108 'apc.shm_segments' => ini_get('apc.shm_segments'),
109 'apc.gc_ttl' => ini_get('apc.gc_ttl'),
110 'apc.user_ttl' => ini_get('apc.ttl'),
111 'info' => $cache_info
112 );
113
114 $cache_info = apc_cache_info();
115 foreach ($cache_info['cache_list'] as $dat) {
116 $key = $dat['key'];
117
118 if (preg_match('/' . $this->getServiceId() . '_' . $this->getComponent() . '/', $key)) {
119 $return[$key] = apc_fetch($key);
120 }
121 }
122
123 return $return;
124 }

References ilGlobalCacheService\getComponent(), and ilGlobalCacheService\getServiceId().

+ Here is the call graph for this function:

◆ getInstallable()

ilApc::getInstallable ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

135 {
136 return function_exists('apc_store');
137 }

◆ getMemoryLimit()

ilApc::getMemoryLimit ( )
protected
Returns
string

Reimplemented from ilGlobalCacheService.

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

143 {
144 if (ilRuntime::getInstance()->isHHVM()) {
145 return $this->getMinMemory() . 'M';
146 }
147
148 return ini_get('apc.shm_size');
149 }
getMinMemory()
static getInstance()

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

+ Here is the call graph for this function:

◆ getMinMemory()

ilApc::getMinMemory ( )
protected
Returns
int

Reimplemented from ilGlobalCacheService.

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

155 {
156 return self::MIN_MEMORY;
157 }
const MIN_MEMORY
Definition: class.ilApc.php:16

References MIN_MEMORY.

Referenced by getMemoryLimit().

+ Here is the caller graph for this function:

◆ serialize()

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

Reimplemented from ilGlobalCacheService.

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

79 {
80 return ($value);
81 }

◆ set()

ilApc::set (   $key,
  $serialized_value,
  $ttl = 0 
)
Parameters
$key
$serialized_value
int$ttl
Returns
array|bool

Reimplemented from ilGlobalCacheService.

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

41 {
42 return apc_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
$serialized_value
Returns
mixed

Reimplemented from ilGlobalCacheService.

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

89 {
90 return ($serialized_value);
91 }

Field Documentation

◆ CACHE_ID

const ilApc::CACHE_ID = 'user'

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

◆ MIN_MEMORY

const ilApc::MIN_MEMORY = 128

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

Referenced by getMinMemory().


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