4 * This is a test of the interface, mainly. It stores things in an associative
5 * array, which is not going to persist between program runs.
9 class HashBagOStuff
extends BagOStuff
{
12 function __construct() {
16 protected function expire( $key ) {
17 $et = $this->bag
[$key][1];
19 if ( ( $et == 0 ) ||
( $et > time() ) ) {
23 $this->delete( $key );
28 function get( $key ) {
29 if ( !isset( $this->bag
[$key] ) ) {
33 if ( $this->expire( $key ) ) {
37 return $this->bag
[$key][0];
40 function set( $key, $value, $exptime = 0 ) {
41 $this->bag
[$key] = array( $value, $this->convertExpiry( $exptime ) );
44 function delete( $key, $time = 0 ) {
45 if ( !isset( $this->bag
[$key] ) ) {
49 unset( $this->bag
[$key] );
55 return array_keys( $this->bag
);