contributions/usermanagement/controller/base/cachemanager/loggedinswitchcachemanager.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Cache manager that caches two versions: One for logged in users and one for guests 00004 * 00005 * If user is logged in, it returns the CacheHeaderManager set 00006 * as ConfigUsermanagement::CACHEHEADER_CLASS_LOGGEDIN 00007 * 00008 * Appends [g] or [u] to the first cache key 00009 * 00010 * @author Gerd Riesselmann 00011 * @ingroup Usermanagement 00012 */ 00013 class LoggedInSwitchCacheManager extends SuccessCacheManager { 00014 /** 00015 * Return a chache id 00016 */ 00017 public function get_cache_id() { 00018 $ret = Arr::force(parent::get_cache_id(), false); 00019 $ret[0] .= Users::is_logged_in() ? '[u]' : '[g]'; 00020 return $ret; 00021 } 00022 00023 /** 00024 * Get cache header manager 00025 * 00026 * @return ICacheHeaderManager 00027 */ 00028 public function get_cache_header_manager() { 00029 if (Users::is_logged_in()) { 00030 return CacheHeaderManagerFactory::create(Config::get_value(ConfigUsermanagement::CACHEHEADER_CLASS_LOGGEDIN)); 00031 } 00032 else { 00033 return parent::get_cache_header_manager(); 00034 } 00035 } 00036 }