ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Assetic\Cache\ApcCache Class Reference

Uses APC to cache files. More...

+ Inheritance diagram for Assetic\Cache\ApcCache:
+ Collaboration diagram for Assetic\Cache\ApcCache:

Public Member Functions

 has ($key)
 
 get ($key)
 
 set ($key, $value)
 
 remove ($key)
 
 has ($key)
 Checks if the cache has a value for a key. More...
 
 get ($key)
 Returns the value for a key. More...
 
 set ($key, $value)
 Sets a value in the cache. More...
 
 remove ($key)
 Removes a value from the cache. More...
 

Data Fields

 $ttl = 0
 

Detailed Description

Uses APC to cache files.

Author
André Roaldseth andre.nosp@m.@roa.nosp@m.ldset.nosp@m.h.ne.nosp@m.t

Definition at line 19 of file ApcCache.php.

Member Function Documentation

◆ get()

Assetic\Cache\ApcCache::get (   $key)
See also
CacheInterface::get()

Implements Assetic\Cache\CacheInterface.

Definition at line 34 of file ApcCache.php.

35 {
36 $value = apc_fetch($key, $success);
37
38 if (!$success) {
39 throw new \RuntimeException('There is no cached value for '.$key);
40 }
41
42 return $value;
43 }
$success
Definition: Utf8Test.php:86

References $success.

◆ has()

Assetic\Cache\ApcCache::has (   $key)
See also
CacheInterface::has()

Implements Assetic\Cache\CacheInterface.

Definition at line 26 of file ApcCache.php.

27 {
28 return apc_exists($key);
29 }

◆ remove()

Assetic\Cache\ApcCache::remove (   $key)
See also
CacheInterface::remove()

Implements Assetic\Cache\CacheInterface.

Definition at line 62 of file ApcCache.php.

63 {
64 return apc_delete($key);
65 }

◆ set()

Assetic\Cache\ApcCache::set (   $key,
  $value 
)
See also
CacheInterface::set()

Implements Assetic\Cache\CacheInterface.

Definition at line 48 of file ApcCache.php.

49 {
50 $store = apc_store($key, $value, $this->ttl);
51
52 if (!$store) {
53 throw new \RuntimeException('Unable to store "'.$key.'" for '.$this->ttl.' seconds.');
54 }
55
56 return $store;
57 }

Field Documentation

◆ $ttl

Assetic\Cache\ApcCache::$ttl = 0

Definition at line 21 of file ApcCache.php.


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