Cache<T, S> class

Generic interface for caching entities. Wraps Map interface and provides utilities for manipulating cache.

Implemented types
Implementers

Constructors

Cache()

Properties

asMap Map<T, S>
Returns cache as Map
read-only
count int
Get number of elements from cache
read-only
first → S
Get first element
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
keys Iterable<T>
Returns key's values of cache
read-only
last → S
Get last element
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
values Iterable<S>
Returns values of cache
read-only

Methods

add(T key, S value) → void
Add to cache value associated with key
addIfAbsent(T key, S item) → S
Puts item to collection if key doesn't exist in cache
addMap(Map<T, S> mp) → void
Add Map to cache.
dispose() Future<void>
Perform cleanup
override
find(bool predicate(S item)) Iterable<S>
Find matching items based of predicate
findOne(bool predicate(S item)) → S
Find one element in cache
forEach(void f(T key, S value)) → void
Loop over elements from cache
hasKey(T key) bool
Returns true if cache contains key
hasValue(S value) bool
Returns true if cache contains value
invalidate() → void
Clear cache
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
remove(T key) → void
Remove key with associated with it value
removeWhere(bool predicate(T key, S value)) → void
Remove everything where predicate is true
take(int count) Iterable<S>
Take count elements from cache. Returns Iterable of cache values
takeLast(int count) Iterable<S>
Takes count last elements from cache. Returns Iterable of cache values
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](T key) → S
Returns element with key key
operator []=(T key, S item) → void
Sets item for key