Cache class

A class representing a cache that queues and processes messages before storing them in the MessageRepository. This cache ensures that messages are processed in batches rather than immediately, reducing the number of operations and increasing efficiency.

Constructors

Cache(MessageRepository messageRepository)
Constructor to initialize the cache with the provided MessageRepository.

Properties

hashCode int
The hash code for this object.
no setterinherited
messageRepository MessageRepository
The repository used to store messages.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes of the timer when the cache is no longer needed.
getAllMessagesByChannel(String channel) Future<List<LocalityEvent>>
Retrieves all messages for the specified channel from the repository.
getChannelFetchTime(String channel) Future<int>
Retrieves the fetch time for the specified channel from the repository.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setChannelFetchTime(String channel, int fetchTime) Future<void>
Sets the fetch time for a given channel if the new fetchTime is greater than the current fetch time stored in the repository.
toString() String
A string representation of this object.
inherited
upsertMessage(LocalityEvent message) Future<void>
Adds a LocalityEvent message to the queue for future processing. If message processing is not currently running, it starts processing the queue.

Operators

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