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
no setter
- count → int
-
Get number of elements from cache
no setter
- first → S?
-
Get first element
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ Iterable<
T> -
Returns key's values of cache
no setter
- last → S
-
Get last element
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
S> -
Returns values of cache
no setter
Methods
-
add(
T key, S value) → void -
Add to cache
value
associated withkey
-
addIfAbsent(
T key, S item) → S -
Puts
item
to collection ifkey
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, S)) → 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 nonexistent 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 -
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
forkey