Construct a cache with the specified maximum number of entries. Additions to the cache beyond this number will throw an exception
clean up when done
Place an entry into the cache and associate it with the provided key. Note that there can be only one entry for any particular key. If two entries are added with the same key, the second effectively overwrites the first.
Get the cache entry identified by the given key
Iterate from the oldest to the most recent additions
Remove and return the more recent addition to the stack
Remove and return the oldest addition to the stack
Place an entry into the cache and associate it with the provided key. Note that there can be only one entry for any particular key. If two entries are added with the same key, the second effectively overwrites the first.
Remove (and return) the cache entry associated with the provided key. Returns false if there is no such entry.
Reaping callback for the hashmap, acting as a trampoline
StackMap extends the basic hashmap type by adding a limit to the number of items contained at any given time. In addition, StackMap retains the order in which elements were added, and employs that during foreach() traversal. Additions to the map beyond the capacity will result in an exception being thrown.
You can push and pop things just like an typical stack, and/or traverse the entries in the order they were added, though with the additional capability of retrieving and/or removing by key.
Note also that a push/add operation will replace an existing entry with the same key, exposing a twist on the stack notion.