Constructor
new TreeKeyValueCache()
Cache working on a basic principle of storing the data as a pair of key, value. Currently the values are
never invalidated.
Methods
add(level, key, value)
Adds new element to the cache. It accepts level, key and value in order
Parameters:
Name | Type | Description |
---|---|---|
level |
Object | Anything that can be used as a key in JavaScript object |
key |
Object | Anything that can be used as a key in JavaScript object |
value |
Object | The value to be stored in the cache on given level and value. Value must started with # |
level(level) → {Object|null}
It returns the whole level of the data. If there is none then undefined is returned.
Parameters:
Name | Type | Description |
---|---|---|
level |
Object | Anything that can be used as a key in JavaScript object |
Returns:
- Type
- Object | null
remove(level, key)
It removes the data from the map if such data exists.
Parameters:
Name | Type | Description |
---|---|---|
level |
Object | Anything that can be used as a key in JavaScript object |
key |
Object | Anything that can be used as a key in JavaScript object |
value(level, key) → {Object|null}
It returns value for key stored at certain level. If there is no such level, it returns null. If there is such leave then the key starting with # gets treated a bit differently.
Parameters:
Name | Type | Description |
---|---|---|
level |
Object | Anything that can be used as a key in JavaScript object |
key |
Object | Anything that can be used as a key in JavaScript object |
Returns:
- Type
- Object | null