core.services.cache

Members list

Packages

Type members

Classlikes

class DistributedCacheService[F[_]](system: ActorSystem, selfUniqueAddress: SelfUniqueAddress)(implicit evidence$1: Async[F], ec: ExecutionContext, distributedTtl: Timeout, localTtlWithUnit: (Int, TimeUnit)) extends CacheServiceTrait[F]

A distributed cache service for managing mechanisms and reactions using Akka Distributed Data.

A distributed cache service for managing mechanisms and reactions using Akka Distributed Data.

This service provides caching with consistency guarantees across multiple nodes in a cluster. It uses LWWMap (Last-Write-Wins Map) for conflict resolution and performs distributed read and write operations with configurable timeouts. Additionally, it leverages a local cache for optimised read-heavy workloads, reducing latency for frequently accessed data.

Type parameters

F

The effect type (e.g., IO, Future, etc.) used to encapsulate asynchronous computations in a functional manner.

Value parameters

distributedTtl

The timeout for distributed operations such as Get and Update in Akka Distributed Data. This defines how long the system will wait for responses in a distributed environment.

ec

The ExecutionContext used for handling asynchronous operations within the service. Ensures non-blocking execution of distributed reads and writes.

localTtlWithUnit

A tuple specifying the expiration duration for entries in the local cache. The tuple consists of an integer value representing the duration and a TimeUnit specifying the unit (e.g., minutes, seconds).

selfUniqueAddress

The unique address of the current node interacting with the cache. This address is used to identify updates and ensure correct state replication in the LWWMap.

system

The ActorSystem used for Akka operations, required to initialise the Distributed Data replicator. It enables communication and coordination across nodes in the cluster.

Attributes

Source
DistributedCacheService.scala
Supertypes
class Object
trait Matchable
class Any
class LocalCacheService[F[_]](implicit evidence$1: Sync[F], ttl: FiniteDuration) extends CacheServiceTrait[F]

A local, in-memory service for caching mechanisms and reactions with a time-to-live (TTL) mechanism.

A local, in-memory service for caching mechanisms and reactions with a time-to-live (TTL) mechanism.

This service uses a TrieMap for thread-safe, concurrent caching. Each cache entry is timestamped, and expired entries are removed based on the configured TTL. The service provides CRUD operations for mechanisms and reactions, ensuring expired entries are not returned or updated.

Type parameters

F

The effect type (e.g., IO, SyncIO, etc.) used to encapsulate computations.

Value parameters

ttl

The time-to-live (TTL) for cache entries. Entries older than this duration are considered expired.

Attributes

Source
LocalCacheService.scala
Supertypes
class Object
trait Matchable
class Any