ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
93  public function deleteUserEntries($a_user_id)
94  {
95  return $this->deleteByAdditionalKeys($a_user_id);
96  }
97 }
98 ?>
static getInstance()
get singleton instance
static _getInstance()
get singleton instance
deleteByAdditionalKeys($a_int_key1=null, $a_int_key2=null, $a_text_key1=null, $a_text_key2=null)
Delete by additional keys.
storeEntry($a_entry_id, $a_value, $a_key1=0, $a_key2=0, $a_key3='', $a_key4='')
Store an entry.
deleteUserEntries($a_user_id)
Delete user entries in cache.
storeUnlimitedEntry($a_entry_id, $a_value, $a_key1=0, $a_key2=0, $a_key3='', $a_key4='')
Store an entry without an expired time.
Cache class.
__construct()
Singleton constructor.
readEntry($a_entry_id)
Get cahed entry if cache is active.
setExpiresAfter($a_val)
Set expires after x seconds.