-class TimeAdjustableHashBagOStuff extends HashBagOStuff {
- private $timeOverride = 0;
-
- public function setTime( $time ) {
- $this->timeOverride = $time;
- }
-
- protected function getCurrentTime() {
- return $this->timeOverride ?: parent::getCurrentTime();
- }
-}
-
-class TimeAdjustableWANObjectCache extends WANObjectCache {
- private $timeOverride = 0;
-
- public function setTime( $time ) {
- $this->timeOverride = $time;
- if ( $this->cache instanceof TimeAdjustableHashBagOStuff ) {
- $this->cache->setTime( $time );
- }
- }
-
- public function addTime( $time ) {
- $this->timeOverride += $time;
- if ( $this->cache instanceof TimeAdjustableHashBagOStuff ) {
- $this->cache->setTime( $this->timeOverride );
- }
-
- return $this->timeOverride;
- }
-
- protected function getCurrentTime() {
- return $this->timeOverride ?: parent::getCurrentTime();
- }
-}
-
-class NearExpiringWANObjectCache extends TimeAdjustableWANObjectCache {