ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCalendarCache.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 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
6 
14 class ilCalendarCache extends ilCache
15 {
16  private static $instance = null;
17 
22  public function __construct()
23  {
24  parent::__construct('ServicesCalendar','Calendar',true);
25  $this->setExpiresAfter(60 * ilCalendarSettings::_getInstance()->getCacheMinutes());
26  }
27 
32  public static function getInstance()
33  {
34  if(isset(self::$instance) and self::$instance)
35  {
36  return self::$instance;
37  }
38  return self::$instance = new ilCalendarCache();
39  }
40 
46  public function readEntry($a_entry_id)
47  {
48  if(!ilCalendarSettings::_getInstance()->isCacheUsed())
49  {
50  return null;
51  }
52  return parent::readEntry($a_entry_id);
53  }
54 
61  public function storeEntry($a_entry_id,$a_value,$a_key1 = 0,$a_key2 = 0,$a_key3 = '',$a_key4 = '')
62  {
63  if(!ilCalendarSettings::_getInstance()->isCacheUsed())
64  {
65  return null;
66  }
67  parent::storeEntry($a_entry_id, $a_value, $a_key1, $a_key2, $a_key3, $a_key4);
68  }
69 
76  public function storeUnlimitedEntry($a_entry_id,$a_value,$a_key1 = 0,$a_key2 = 0,$a_key3 = '',$a_key4 = '')
77  {
78  if(!ilCalendarSettings::_getInstance()->isCacheUsed())
79  {
80  return null;
81  }
82  // Unlimited is a year
83  $this->setExpiresAfter(60 * 60 * 24 * 365);
84  parent::storeEntry($a_entry_id,$a_value, $a_key1, $a_key2, $a_key3, $a_key4);
85  $this->setExpiresAfter(ilCalendarSettings::_getInstance()->getCacheMinutes());
86  return true;
87  }
88 }
89 ?>