InMemoryCacheManager

In memory cache manager

Events are stored in eventHashMap in memory only

Open class that can be extended and add the logic for storing events in disk

Keep events in memory and disk synced all the time, in case of crash, events will not be lost

add, addAll, remove, removeAll, updateEventStatus, updateEventStatusAll are annotated with CallSuper, Any class extending InMemoryCacheManager for disk caching logic, need to write events in memory as well

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open override fun add(event: Event): Boolean

Add Single event to the memory

Link copied to clipboard
open override fun addAll(eventList: List<Event>): Boolean

Add List of events to the memory

Link copied to clipboard
open override fun getEvents(status: List<EventStatus>): List<Event>

Get List of events from the memory based on the status

Link copied to clipboard
open override fun getEventSize(status: List<EventStatus>): Int

Get count of events in memory based on the status

Link copied to clipboard
open override fun getEventSizeInBytes(status: List<EventStatus>): Int

Get size of events in memory in bytes based on the status

Link copied to clipboard
open override fun remove(event: Event): Boolean

Remove single event from the memory

Link copied to clipboard
open override fun removeAll(status: List<EventStatus>): Boolean

Remove list of events from the memory based on the status

Link copied to clipboard
open override fun syncDataFromCache(success: (Boolean, List<Event>) -> Unit)

Fetch events from the disk

Link copied to clipboard
open override fun syncDataToCache(success: (Boolean) -> Unit)

Fetch in memory events and push all the events to disk

Link copied to clipboard
open override fun updateEventStatus(event: Event, status: EventStatus): Boolean

Update status for the event to the memory

Link copied to clipboard
open override fun updateEventStatusAll(eventList: List<Event>, status: EventStatus): Boolean

Update status for the list of events to the memory