ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilNewsCache.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Cache/classes/class.ilCache.php");
5 
13 class ilNewsCache extends ilCache
14 {
18  protected $settings;
19 
20  public static $disabled = false;
21 
28  public function __construct()
29  {
30  global $DIC;
31 
32  $this->settings = $DIC->settings();
33  $ilSetting = $DIC->settings();
34 
35  $news_set = new ilSetting("news");
36  $news_set->get("acc_cache_mins");
37 
38  parent::__construct("ServicesNews", "News", true);
39  $this->setExpiresAfter($news_set->get("acc_cache_mins") * 60);
40  if ((int) $news_set->get("acc_cache_mins") == 0) {
41  self::$disabled = true;
42  }
43  }
44 
49  public function isDisabled()
50  {
51  return self::$disabled or parent::isDisabled();
52  }
53 
54 
58  public function readEntry($a_id)
59  {
60  if (!$this->isDisabled()) {
61  return parent::readEntry($a_id);
62  }
63  return false;
64  }
65 
66 
70  public function storeEntry(
71  $a_id,
72  $a_value,
73  $a_int_key1 = null,
74  $a_int_key2 = null,
75  $a_text_key1 = null,
76  $a_text_key2 = null
77  ) {
79  if (!$this->isDisabled()) {
80  parent::storeEntry($a_id, $a_value);
81  }
82  }
83 }
readEntry($a_id)
Read an entry.
settings()
Definition: settings.php:2
storeEntry( $a_id, $a_value, $a_int_key1=null, $a_int_key2=null, $a_text_key1=null, $a_text_key2=null)
Id is user_id:ref_id, we store ref_if additionally.
__construct()
Constructor.
global $DIC
Definition: saml.php:7
News cache.
Cache class.
isDisabled()
Check if cache is disabled.
global $ilSetting
Definition: privfeed.php:17
setExpiresAfter($a_val)
Set expires after x seconds.