Generic string->value map that is stored in a given block.

This class is described in detail in Generic Containers article.

Constructor

new (s:ServerClass, b:Block, a:String)

Creates a new generic key-value map on top of cache block.

Parameters:

s

Slave server.

b

Cache block.

a

Block attribute name.

Methods

inline decrease (key:String, ?value:Int):Void

Decreases Int value by a given amount.

Parameters:

key

Map key.

value

Amount to decrease by.

value

Amount to decrease by. Defaults to 1.

get (key:String):Int

Returns map value as Int.

Parameters:

key

Map key.

Returns:

Map value. Returns 0, if this mapping is not found.

getDynamic (key:String):Dynamic

Returns map value as Dynamic.

Parameters:

key

Map key.

Returns:

Map value. Returns null, if this mapping is not found.

getFloat (key:String):Float

Returns map value as Float.

Parameters:

key

Map key.

Returns:

Map value. Returns 0, if this mapping is not found.

inline increase (key:String, ?value:Int):Void

Increases Int value by a given amount.

Parameters:

key

Map key.

value

Amount to increase by. Defaults to 1.

set (key:String, val:Dynamic):Void

Maps key to a given value. If the new value equals the old one, nothing happens. If the new value is 0, the mapping will be deleted. Will call the setPre() and setPost() hooks.

Parameters:

key

Map key.

val

New value.

dynamic setPost (key:String, oldValue:Dynamic, value:Dynamic):Void

This method is called after mapping values.

Parameters:

key

Map key.

oldValue

Old value.

value

New value.

dynamic setPre (key:String, oldValue:Dynamic, value:Dynamic):Bool

This method is called before mapping values. If it returns false, the value will not be changed.

Parameters:

key

Map key.

oldValue

Old value.

value

New value.

Returns:

True, if setting value should be allowed. False otherwise.