CacheIt<K, V> class

Create an instance of a cache object.

Constructors

CacheIt({int ttl = 3600})
Creates a new CacheIt object. The constructor takes an optional ttl paramter to set time-to-live for entries in seconds. The default is 3600 seconds or one hour.

Properties

entries Iterable<V?>
no setter
hashCode int
The hash code for this object.
no setterinherited
id String
Unique cache id
final
length int
Returns the number cached entries, whether expired or not.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ttl int
Retrieve ttl for this particular cache.
getter/setter pair

Methods

add(K key, V value) → V?
Add new key and value entry to the cache.
clear() → void
Removes all entries from the cache.
get(K key) → V?
Retrieve cache value associated with key.
getOrUpdate(K key, CacheBuilderFn<V> builder) Future<V?>
Retrieve cache value associated with key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prune() → void
Removes all expired entries from the cache. To be used when cache size and space is an issue.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited