ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Cache\Adaptor\APCu Class Reference
+ Inheritance diagram for ILIAS\Cache\Adaptor\APCu:
+ Collaboration diagram for ILIAS\Cache\Adaptor\APCu:

Public Member Functions

 isAvailable ()
 
 has (string $container, string $key)
 
 get (string $container, string $key)
 
 set (string $container, string $key, string $value, int $ttl)
 
 delete (string $container, string $key)
 
 flushContainer (string $container)
 
 flush ()
 
- Public Member Functions inherited from ILIAS\Cache\Adaptor\BaseAdaptor
 __construct (protected Config $config)
 
- Public Member Functions inherited from ILIAS\Cache\Adaptor\Adaptor
 __construct (Config $config)
 
 isAvailable ()
 
 has (string $container, string $key)
 
 get (string $container, string $key)
 
 set (string $container, string $key, string $value, int $ttl)
 
 delete (string $container, string $key)
 
 flushContainer (string $container)
 
 flush ()
 

Static Protected Attributes

static bool $is_available = null
 

Additional Inherited Members

- Data Fields inherited from ILIAS\Cache\Adaptor\Adaptor
const CONTAINER_PREFIX_SEPARATOR = ':'
 
- Protected Member Functions inherited from ILIAS\Cache\Adaptor\BaseAdaptor
 buildKey (string $container, string $key)
 
 buildContainerPrefix (string $container)
 
- Protected Attributes inherited from ILIAS\Cache\Adaptor\BaseAdaptor
const LOCK_UNTIL = '_lock_until'
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 26 of file APCu.php.

Member Function Documentation

◆ delete()

ILIAS\Cache\Adaptor\APCu::delete ( string  $container,
string  $key 
)

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 58 of file APCu.php.

58 : void
59 {
60 apcu_delete($this->buildKey($container, $key));
61 }
buildKey(string $container, string $key)
Definition: BaseAdaptor.php:42
$container
@noRector
Definition: wac.php:37

References ILIAS\Cache\Adaptor\BaseAdaptor\buildKey().

+ Here is the call graph for this function:

◆ flush()

ILIAS\Cache\Adaptor\APCu::flush ( )

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 68 of file APCu.php.

68 : void
69 {
70 apcu_clear_cache();
71 }

◆ flushContainer()

ILIAS\Cache\Adaptor\APCu::flushContainer ( string  $container)

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 63 of file APCu.php.

63 : void
64 {
65 apcu_delete(new \APCUIterator('/^' . $this->buildContainerPrefix($container) . '/'));
66 }
buildContainerPrefix(string $container)
Definition: BaseAdaptor.php:47

References ILIAS\Cache\Adaptor\BaseAdaptor\buildContainerPrefix().

+ Here is the call graph for this function:

◆ get()

ILIAS\Cache\Adaptor\APCu::get ( string  $container,
string  $key 
)

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 40 of file APCu.php.

40 : ?string
41 {
42 $success = false;
43 $return = apcu_fetch($this->buildKey($container, $key), $success) ?: null;
44 if (!$success) {
45 return null;
46 }
47
48 return $return;
49 }

References ILIAS\Cache\Adaptor\BaseAdaptor\buildKey().

+ Here is the call graph for this function:

◆ has()

ILIAS\Cache\Adaptor\APCu::has ( string  $container,
string  $key 
)

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 35 of file APCu.php.

35 : bool
36 {
37 return apcu_exists($this->buildKey($container, $key));
38 }

References ILIAS\Cache\Adaptor\BaseAdaptor\buildKey().

+ Here is the call graph for this function:

◆ isAvailable()

ILIAS\Cache\Adaptor\APCu::isAvailable ( )

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 30 of file APCu.php.

30 : bool
31 {
32 return self::$is_available ?? self::$is_available = (\function_exists('apcu_fetch') && filter_var(\ini_get('apc.enabled'), \FILTER_VALIDATE_BOOL));
33 }

◆ set()

ILIAS\Cache\Adaptor\APCu::set ( string  $container,
string  $key,
string  $value,
int  $ttl 
)

Implements ILIAS\Cache\Adaptor\Adaptor.

Definition at line 51 of file APCu.php.

51 : void
52 {
53 if (!apcu_store($this->buildKey($container, $key), $value, $ttl)) {
54 // silently fail?
55 }
56 }

References ILIAS\Cache\Adaptor\BaseAdaptor\buildKey().

+ Here is the call graph for this function:

Field Documentation

◆ $is_available

bool ILIAS\Cache\Adaptor\APCu::$is_available = null
staticprotected

Definition at line 28 of file APCu.php.


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