command / me.schlaubi.regnumutils.common.cache / MessageCache

MessageCache

interface MessageCache : MutableMap<Long, Message>

Cache for messages in order to get the old content in MESSAGE_UPDATE and MESSAGE_DELETE events.

See Also

Message

Properties

entries

open val entries: MutableSet<MutableEntry<Long, Message>>

keys

abstract val keys: MutableSet<Long>

A MutableSet of all cached ids.

values

abstract val values: MutableCollection<Message>

A MutableSet of all cached messages

Functions

cacheMessage

open fun cacheMessage(message: Message): Message?

Adds a message to the cache.

clear

abstract fun clear(): Unit

Clears the cache

contains

abstract operator fun contains(id: Long): Boolean

Checks whether an id is cached or not.

containsKey

open fun containsKey(key: Long): Boolean

containsValue

open fun containsValue(value: Message): Nothing

get

abstract operator fun get(key: Long): Message?

Gets a message from the cache.

isEmpty

abstract fun isEmpty(): Boolean

Checks whether there is at least one message cached.

minusAssign

open operator fun minusAssign(id: Long): Unit
open operator fun minusAssign(message: Message): Unit

plusAssign

open operator fun plusAssign(message: Message): Unit

put

abstract fun put(key: Long, value: Message): Message?

Adds a message to the cache.

putAll

open fun putAll(from: Map<out Long, Message>): Nothing

remove

abstract fun remove(key: Long): Message?

Removes a message by it's id from the cache.

open fun remove(message: Message): Message?

Removes the message from the cache.

Companion Object Functions

activate

fun activate(eventManager: EventManager): MessageCache

Creates a new Message cache and registers it's listner to the specified eventManager.

Inheritors

MemoryMessageCache

class MemoryMessageCache : MessageCache