MessageCache class

Cache for messages. Provides few utilities methods to facilitate interaction with messages. []= operator throws - use put() instead.

Inheritance

Properties

asMap Map<Snowflake, Message>
Returns cache as Map
read-only, inherited
byBot Iterable<Message>
Returns messages which were sent by bots
read-only
count int
Get number of elements from cache
read-only, inherited
first Message
Get first element
read-only, override
hashCode int
The hash code for this object. [...]
read-only, inherited
inOrder List<Message>
Returns messages in chronological order
read-only
keys Iterable<Snowflake>
Returns key's values of cache
read-only, inherited
last Message
Get last element
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
values Iterable<Message>
Returns values of cache
read-only, inherited

Methods

add(Snowflake key, Message value) → void
Add to cache value associated with key
inherited
addIfAbsent(Snowflake key, Message item) Message
Puts item to collection if key doesn't exist in cache
inherited
addMap(Map<Snowflake, Message> mp) → void
Add Map to cache.
inherited
afterDate(DateTime date) Iterable<Message>
Returns messages which were created before date
beforeDate(DateTime date) Iterable<Message>
Returns messages which were created before date
dispose() Future<void>
Perform cleanup
inherited
find(bool predicate(Message item)) Iterable<Message>
Find matching items based of predicate
inherited
findOne(bool predicate(Message item)) Message
Find one element in cache
inherited
forEach(void f(Snowflake key, Message value)) → void
Loop over elements from cache
inherited
fromUser(User user) Iterable<Message>
Returns messages which were sent by user
fromUsers(Iterable<User> users) Iterable<Message>
Returns messages which were sent by users
hasKey(Snowflake key) bool
Returns true if cache contains key
inherited
hasValue(Message value) bool
Returns true if cache contains value
inherited
invalidate() → void
Clear cache
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
put(Message message) Message
Allows to put message into cache
remove(Snowflake key) → void
Remove key with associated with it value
inherited
removeWhere(bool predicate(Snowflake key, Message value)) → void
Remove everything where predicate is true
inherited
take(int count) Iterable<Message>
Takes first count elements from cache. Returns Iterable of cache values
override
takeLast(int count) Iterable<Message>
Takes last count elements from cache. Returns Iterable of cache values
override
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](Snowflake key) Message
Returns element with key key
inherited
operator []=(Snowflake key, Message item) → void
Unsupported
override