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

Scheduled least recently written eviction policy for Cachex.

This module implements a scheduled LRW eviction policy for Cachex, using a basic timer to trigger bound enforcement in a repeatable way. This has the same bound accuracy as Cachex.Policy.LRW.Evented, but has potential for some delay. The main advantage of this implementation is a far lower memory cost due to not using hook messages.

Initialization

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

Options

  • :frequency

    The polling frequency for this hook to use when scheduling cache pruning. This should be an non-negative number of milliseconds. Defaults to 1000, which is once per second.

Summary

Functions

Returns the provisions this policy requires.

Functions

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

Returns the provisions this policy requires.