Especially useful when interacting with getWithSetCallback of
HashBagOStuff where a $exptime is required before the callback.
In set() it is typically left out and thus not as counter-intuitive.
Change-Id: Ic2f7adda3c00cefe701d77bea91a7e8e77ef1439
protected function expire( $key ) {
$et = $this->bag[$key][self::KEY_EXP];
- if ( $et == 0 || $et > time() ) {
+ if ( $et == self::TTL_INDEFINITE || $et > time() ) {
return false;
}
const TTL_WEEK = 604800; // 7 * 24 * 3600
const TTL_MONTH = 2592000; // 30 * 24 * 3600
const TTL_YEAR = 31536000; // 365 * 24 * 3600
+
+ const TTL_INDEFINITE = 0;
}
/** Default time-since-expiry on a miss that makes a key "hot" */
const LOCK_TSE = 1;
- /** Idiom for set()/getWithSetCallback() TTL being "forever" */
- const TTL_INDEFINITE = 0;
/** Idiom for getWithSetCallback() callbacks to avoid calling set() */
const TTL_UNCACHEABLE = -1;
/** Idiom for getWithSetCallback() callbacks to 'lockTSE' logic */