Object -
cache
:
Cache
Represents a cache.
Constructor
__init
(int expiryTimeInMillis, int capacity, float evictionFactor)
- expiryTimeInMillis int 900000
- capacity int 100
- evictionFactor float 0.25
Methods
Checks whether the given key has an accociated cache value.
Returns the size of the cache.
Adds the given key, value pair to the provided cache.
Returns the cached value associated with the given key. If the provided cache key is not found, () will be returned.
Removes a cached value from a cache.
Returns all keys from current cache.
Checks whether the given key has an accociated cache value.
Parameters
- key string
-
the key to be checked
-
Return Type
(boolean) True if the given key has an associated value, false otherwise.
Adds the given key, value pair to the provided cache.
Parameters
- key string
-
value which should be used as the key
- value any
-
value to be cached
Returns the cached value associated with the given key. If the provided cache key is not found, () will be returned.
Parameters
- key string
-
key which is used to retrieve the cached value
-
Return Type
(any) The cached value associated with the given key
Removes a cached value from a cache.
Parameters
- key string
-
key of the cache entry which needs to be removed