Documentation ¶
Overview ¶
package mem contains an implementation of the fes backend using an in-memory cache.
This implementation is typically used for development and test purposes. However, if you are targeting pure performance, you can use this backend to effectively trade in persistence-related guarantees (e.g. fault-tolerance) to avoid overhead introduced by other event stores, such as the NATS implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrEventLimitExceeded = &fes.EventStoreErr{
S: "event limit exceeded",
}
)
Functions ¶
This section is empty.
Types ¶
type Backend ¶
Backend is an in-memory, fes-compatible backend using a map for active entities with a LRU cache to store completed event streams, evicting oldest ones if it runs out of space. Active entities will never be deleted.
func NewBackend ¶
type Config ¶
type Config struct { // MaxKeys specifies the limit of keys (or aggregates) in the backend. // If set to 0, MaxInt32 will be used as the limit. MaxKeys int // MaxEventsPerKey specifies a limit on the number MaxEventsPerKey int }
Config contains the user-configurable options of the in-memory backend.
To limit the memory consumption of the backend, you can make use of the MaxKeys and MaxEventsPerKey. The absolute maximum memory usage is the product of the two limits.