jenkins-bot has submitted this change and it was merged.
Change subject: objectcache: Add TTL_INDEFINITE to IExpiringStore
......................................................................
objectcache: Add TTL_INDEFINITE to IExpiringStore
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
---
M includes/libs/objectcache/HashBagOStuff.php
M includes/libs/objectcache/IExpiringStore.php
M includes/libs/objectcache/WANObjectCache.php
3 files changed, 3 insertions(+), 3 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/libs/objectcache/HashBagOStuff.php
b/includes/libs/objectcache/HashBagOStuff.php
index bdcf180..432d040 100644
--- a/includes/libs/objectcache/HashBagOStuff.php
+++ b/includes/libs/objectcache/HashBagOStuff.php
@@ -50,7 +50,7 @@
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;
}
diff --git a/includes/libs/objectcache/IExpiringStore.php
b/includes/libs/objectcache/IExpiringStore.php
index b5ad702..fa465c7 100644
--- a/includes/libs/objectcache/IExpiringStore.php
+++ b/includes/libs/objectcache/IExpiringStore.php
@@ -37,4 +37,6 @@
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;
}
diff --git a/includes/libs/objectcache/WANObjectCache.php
b/includes/libs/objectcache/WANObjectCache.php
index c04d4b6..7e3fa4f 100644
--- a/includes/libs/objectcache/WANObjectCache.php
+++ b/includes/libs/objectcache/WANObjectCache.php
@@ -95,8 +95,6 @@
/** 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 */
--
To view, visit https://gerrit.wikimedia.org/r/250643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2f7adda3c00cefe701d77bea91a7e8e77ef1439
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits