/** * Constructor * * @param * @return */ function __construct() { parent::__construct("ServicesCache", "Example", false); $this->setExpiresAfter(5); // only five seconds to make a hit // usually you would this value from some setting }
/** * Id is user_id:ref_id, we store ref_if additionally */ function storeEntry($a_id, $a_value) { global $ilSetting; if (!$this->isDisabled()) { parent::storeEntry($a_id, $a_value); } }
/** * Store an entry without an expired time * @param object $a_entry_id * @param object $a_value * @return */ public function storeUnlimitedEntry($a_entry_id, $a_value, $a_key1 = 0, $a_key2 = 0, $a_key3 = '', $a_key4 = '') { if (!ilCalendarSettings::_getInstance()->isCacheUsed()) { return null; } // Unlimited is a year $this->setExpiresAfter(60 * 60 * 24 * 365); parent::storeEntry($a_entry_id, $a_value, $a_key1, $a_key2, $a_key3, $a_key4); $this->setExpiresAfter(ilCalendarSettings::_getInstance()->getCacheMinutes()); return true; }
/** * This one can be called, e.g. */ function deleteByRefId($a_ref_id) { parent::deleteByAdditionalKeys($a_ref_id); }