*/
class HashBagOStuff extends BagOStuff {
/** @var mixed[] */
- protected $bag = array();
+ protected $bag = [];
/** @var integer Max entries allowed */
protected $maxCacheKeys;
* @param array $params Additional parameters include:
* - maxKeys : only allow this many keys (using oldest-first eviction)
*/
- function __construct( $params = array() ) {
+ function __construct( $params = [] ) {
parent::__construct( $params );
$this->maxCacheKeys = isset( $params['maxKeys'] ) ? $params['maxKeys'] : INF;
public function set( $key, $value, $exptime = 0, $flags = 0 ) {
// Refresh key position for maxCacheKeys eviction
unset( $this->bag[$key] );
- $this->bag[$key] = array(
+ $this->bag[$key] = [
self::KEY_VAL => $value,
self::KEY_EXP => $this->convertExpiry( $exptime )
- );
+ ];
if ( count( $this->bag ) > $this->maxCacheKeys ) {
reset( $this->bag );
}
public function clear() {
- $this->bag = array();
+ $this->bag = [];
}
}