View Source Cachex.Limit.Evented (Cachex v4.0.3)

Evented least recently written eviction policy for Cachex.

This module implements an evented LRW eviction policy for Cachex, using a hook to listen for new key additions to a cache and enforcing bounds in a reactive way. This policy enforces cache bounds and limits far more accurately than other scheduled implementations, but comes at a higher memory cost (due to the message passing between hooks).

Initialization

hook(module: Cachex.Limit.Evented, args: {
  500,  # setting cache max size
  []    # options for `Cachex.prune/3`
})

Summary

Functions

Returns the actions this policy should listen on.

Returns the provisions this policy requires.

Functions

@spec actions() :: [atom()]

Returns the actions this policy should listen on.

@spec provisions() :: [atom()]

Returns the provisions this policy requires.