Raxol.Core.Performance.Memoization.MemoizationServer (Raxol v2.0.1)

View Source

GenServer implementation for function memoization cache.

This server manages memoized function results, eliminating Process dictionary usage in favor of supervised state management with automatic cache expiry.

Features

  • Per-process memoization cache
  • Automatic cache expiry
  • Memory-efficient storage
  • Cache hit/miss tracking

Summary

Functions

Returns a child specification for this server.

Clears memoization cache for the calling process.

Clears a specific key from the memoization cache.

Gets a memoized value if it exists.

Gets a memoized value if it exists (alternative name for get/1).

Gets a memoized value or computes and stores it.

Stores a memoized value (alternative name for put/2).

Stores a memoized value.

Gets cache statistics.

Functions

child_spec(init_arg)

Returns a child specification for this server.

clear()

Clears memoization cache for the calling process.

clear_key(key)

Clears a specific key from the memoization cache.

get(key)

Gets a memoized value if it exists.

get_memoized(key)

Gets a memoized value if it exists (alternative name for get/1).

get_or_compute(key, fun)

Gets a memoized value or computes and stores it.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

memoize(key, value)

Stores a memoized value (alternative name for put/2).

put(key, value)

Stores a memoized value.

start_link(init_opts \\ [])

stats()

Gets cache statistics.