2require_once(
'./Services/GlobalCache/classes/Memcache/class.ilMemcache.php');
 
    3require_once(
'./Services/GlobalCache/classes/Xcache/class.ilXcache.php');
 
    4require_once(
'./Services/GlobalCache/classes/Apc/class.ilApc.php');
 
    5require_once(
'./Services/GlobalCache/classes/Static/class.ilStaticCache.php');
 
    6require_once(
'Settings/class.ilGlobalCacheSettings.php');
 
   16    const MSG = 
'Global Cache not active, can not access cache';
 
   64        self::COMP_TPL_BLOCKS,
 
   65        self::COMP_TPL_VARIABLES,
 
  123            $ilGlobalCache->initCachingService();
 
  125            self::$instances[
$component] = $ilGlobalCache;
 
  143    protected function initCachingService()
 
  152        $ilGlobalCacheService = 
new $serviceName(self::$unique_service_id, $this->
getComponent());
 
  154        $this->global_cache = $ilGlobalCacheService;
 
  173        if ($log_level <= self::getSettings()->getLogLevel()) {
 
  176            $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
 
  178            $class = $backtrace[1][
'class'];
 
  191        if (!isset(self::$unique_service_id)) {
 
  194                $rawServiceId .= 
'il_' . CLIENT_ID;
 
  196            self::$unique_service_id = substr(md5($rawServiceId), 0, 6);
 
  201    public static function flushAll()
 
  207        foreach (self::$types as 
$type) {
 
  209            $service = 
new $serviceName(self::generateServiceId(), 
'flush');
 
  225        foreach (self::getAllTypes() as 
$type) {
 
  226            if (
$type->isCacheServiceInstallable()) {
 
  242        foreach (self::$types as 
$type) {
 
  243            if ($only_available && !in_array(
$type, self::$available_types)) {
 
  246            $obj = 
new self(
$type);
 
  247            $obj->initCachingService();
 
  273                return 'ilStaticCache';
 
  290        if (self::$active_cache[$this->
getComponent()] !== 
null) {
 
  305        $isActive = $this->global_cache->isActive();
 
  321        return $this->global_cache->isValid(
$key);
 
  330        return count(self::getAllInstallableTypes()) > 0;
 
  339        return $this->global_cache->isInstallable();
 
  348        return $this->global_cache->getInstallationFailureReason();
 
  360        if (!$this->global_cache->isActive()) {
 
  364        return $this->global_cache->exists(
$key);
 
  376    public function set(
$key, $value, $ttl = 
null)
 
  382        $this->global_cache->setValid(
$key);
 
  384        return $this->global_cache->set(
$key, $this->global_cache->serialize($value), $ttl);
 
  399        $unserialized_return = $this->global_cache->unserialize($this->global_cache->get(
$key));
 
  400        if ($unserialized_return) {
 
  402            if ($this->global_cache->isValid(
$key)) {
 
  405                return $unserialized_return;
 
  426        return $this->global_cache->delete(
$key);
 
  436    public function flush($complete = 
false)
 
  438        if ($this->global_cache->isActive()) {
 
  439            return $this->global_cache->flush();
 
  448        return $this->global_cache->getInfo();
 
  506            return $this->global_cache->getServiceType();
 
An exception for terminatinating execution or to throw for unit testing.
Component logger with individual log levels by component id.
Class ilGlobalCacheService.
Class ilGlobalCacheSettings.
setServiceType($service_type)
static setSettings($settings)
static $active_components
getInstallationFailureReason()
static setAvailableComponents($available_components)
static $available_components
isCacheServiceInstallable()
static setup(ilGlobalCacheSettings $ilGlobalCacheSettings)
static lookupServiceClassName($service_type)
static getAllInstallableTypes()
static getAllTypes($only_available=true)
static setActiveComponents($active_components)
static getActiveComponents()
static $unique_service_id
static log($message, $log_level)
__construct($service_type)
static $type_per_component
static getAvailableComponents()
static getInstance($component)
static generateServiceId()
catch(Exception $e) $message
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'