Cache<T> class

A simple cache for SnowflakeEntitys.

Mixed in types

Constructors

Cache(Nyxx client, String identifier, CacheConfig<T> config)
Create a new cache with the provided config.

Properties

client Nyxx
The client this cache is associated with.
final
config CacheConfig<T>
The configuration for this cache.
final
entries Iterable<MapEntry<Snowflake, T>>
The map entries of this.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
identifier String
An identifier for this cache.
final
isEmpty bool
Whether there is no key/value pair in the map.
no setterinherited
isNotEmpty bool
Whether there is at least one key/value pair in the map.
no setterinherited
keys Iterable<Snowflake>
The keys of this.
no setteroverride
length int
The number of key/value pairs in the map.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values Iterable<T>
The values of this.
no setterinherited

Methods

addAll(Map<Snowflake, T> other) → void
Adds all key/value pairs of other to this map.
inherited
addEntries(Iterable<MapEntry<Snowflake, T>> newEntries) → void
Adds all key/value pairs of newEntries to this map.
inherited
cast<RK, RV>() Map<RK, RV>
Provides a view of this map as having RK keys and RV instances, if necessary.
inherited
clear() → void
Removes all entries from the map.
override
containsKey(Object? key) bool
Whether this map contains the given key.
inherited
containsValue(Object? value) bool
Whether this map contains the given value.
inherited
filterItems() → void
Filter the items in the cache so that it obeys the config.
forEach(void action(Snowflake key, T value)) → void
Applies action to each key/value pair of the map.
inherited
map<K2, V2>(MapEntry<K2, V2> transform(Snowflake key, T value)) Map<K2, V2>
Returns a new map where all entries of this map are transformed by the given convert function.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putIfAbsent(Snowflake key, T ifAbsent()) → T
Look up the value of key, or add a new entry if it isn't there.
inherited
remove(Object? key) → T?
Removes key and its associated value, if present, from the map.
override
removeWhere(bool test(Snowflake key, T value)) → void
Removes all entries of this map that satisfy the given test.
inherited
scheduleFilterItems() → void
Schedule filterItems to be run, if it isn't already scheduled.
toString() String
A string representation of this object.
inherited
update(Snowflake key, T update(T value), {T ifAbsent()?}) → T
Updates the value for the provided key.
inherited
updateAll(T update(Snowflake key, T value)) → void
Updates all values.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](Object? key) → T?
The value for the given key, or null if key is not in the map.
override
operator []=(Snowflake key, T value) → void
Associates the key with the given value.
override

Static Methods

cachesFor(Nyxx client) Map<String, Map<Snowflake, Object?>>
Return a mapping of identifier to cache contents for all caches associated with client.