Object - cache : Cache

Represents a cache.

hasKey

(string key)

returns boolean

Checks whether the given key has an accociated cache value.

Parameters

  • Return Type

    (boolean)
  • True if the given key has an associated value, false otherwise.

size

()

returns int

Returns the size of the cache.

  • Return Type

    (int)
  • The size of the cache

put

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

get

(string key)

returns any?

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

remove

Removes a cached value from a cache.

Parameters

  • key string
  • key of the cache entry which needs to be removed

keys

()

returns string[]

Returns all keys from current cache.

  • Return Type

    (string[])
  • all keys