diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /includes/objectcache/HashBagOStuff.php | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff) |
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook
* Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/objectcache/HashBagOStuff.php')
-rw-r--r-- | includes/objectcache/HashBagOStuff.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/includes/objectcache/HashBagOStuff.php b/includes/objectcache/HashBagOStuff.php new file mode 100644 index 00000000..36773306 --- /dev/null +++ b/includes/objectcache/HashBagOStuff.php @@ -0,0 +1,58 @@ +<?php + +/** + * This is a test of the interface, mainly. It stores things in an associative + * array, which is not going to persist between program runs. + * + * @ingroup Cache + */ +class HashBagOStuff extends BagOStuff { + var $bag; + + function __construct() { + $this->bag = array(); + } + + protected function expire( $key ) { + $et = $this->bag[$key][1]; + + if ( ( $et == 0 ) || ( $et > time() ) ) { + return false; + } + + $this->delete( $key ); + + return true; + } + + function get( $key ) { + if ( !isset( $this->bag[$key] ) ) { + return false; + } + + if ( $this->expire( $key ) ) { + return false; + } + + return $this->bag[$key][0]; + } + + function set( $key, $value, $exptime = 0 ) { + $this->bag[$key] = array( $value, $this->convertExpiry( $exptime ) ); + } + + function delete( $key, $time = 0 ) { + if ( !isset( $this->bag[$key] ) ) { + return false; + } + + unset( $this->bag[$key] ); + + return true; + } + + function keys() { + return array_keys( $this->bag ); + } +} + |