Skip to content
CAI
Software that uses CAICheck a score

melpon/memoize

57.6

Adequate · 18 September 2026

700

lines of production code

Elixir

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a memoization library for Elixir that provides macros to cache function results in ETS tables. It supports configurable cache strategies, including time-based expiration and memory-based eviction, while managing concurrency through waiter limits. The library also includes utilities for cache invalidation and garbage collection, with comprehensive test coverage for concurrent access safety.

Features

Initial release of the Memoize library with configurable caching and concurrency control

This entry introduces the Memoize library (version 1.0.0), providing a \defmemo\ macro for function memoization backed by ETS. The implementation includes a new \Memoize.Cache\ module for managing cache entries and a \Memoize.CacheStrategy\ behavior for pluggable eviction policies. Key features include support for map-type cache keys via normalization, configurable waiter limits (\max\_waiters\) to control concurrent execution, and options to disable garbage collection when the threshold is set to infinity. The application now initializes configuration via \Memoize.Config\ using persistent term storage, replacing the previous hardcoded ETS tab approach.

lib/memoize · high confidence

Introduction of \`defmemo\` and \`defmemop\` macros for memoization

The library now provides \defmemo\ and \defmemop\ macros, allowing users to define public and private functions that are automatically memoized. These macros transform function definitions to cache results in an ETS table, handling concurrent execution and cache invalidation, replacing the previous internal implementation.

lib · high confidence

New configurable cache strategies with expiration and eviction support

The library now includes two new cache strategy implementations: \Memoize.CacheStrategy.Default\ and \Memoize.CacheStrategy.Eviction\. The Default strategy supports a configurable \:expires\_in\ option (defaulting to \:infinity\) to handle time-based expiration of cached values. The Eviction strategy introduces memory-based eviction using \:max\_threshold\ and \:min\_threshold\ options, tracking read history and expiration times in separate ETS tables to manage memory usage. Both strategies implement the \Memoize.CacheStrategy\ behaviour and replace the previous \MemoryStrategy\.

_lib/memoize/cache\strategy · high confidence

Behavioural changes

Library restructured with new cache strategies and configuration options

The memoization library has been updated to version 1.4.5, introducing a new \Memoize.CacheStrategy.Eviction\ strategy alongside the existing default, allowing users to manage cache memory via thresholds. Users can now configure a default expiration time (\:expires\_in\) for cached values and access waiter process options directly through \defmemo\ opts. The release also includes fixes for double-calling \normalize\_key\, deadlocks when max waiters die, and proper clearing of expiration tables during invalidation or garbage collection. Additionally, the project now enforces code formatting via \.formatter.exs\ and specifies supported tool versions in \.tool-versions\.

(repo-wide) · high confidence

Removal of legacy Mix.Config configuration file

The \config/config.exs\ file has been deleted, removing the previous Mix.Config-based configuration mechanism for the application. This change eliminates the ability to configure the application via this specific file, likely as part of a migration to a new configuration strategy or dependency management approach.

config · high confidence

Test coverage

Expanded test coverage for memoization cache and macro behavior

Added comprehensive tests for the \Memoize.Cache\ module, verifying concurrent access safety, crash recovery, and expiration logic. Updated \MemoizeTest\ to validate the \defmemo\ macro's support for guards, default arguments, map-type keys, and dynamic function names via \unquote\. Introduced a shared test helper (\Memoize.Case\) to configure and switch between different cache strategies (Default, Eviction) and waiter configurations during test runs.

test · high confidence

Dependencies

Update Elixir requirement and add documentation dependencies

The project now requires Elixir 1.11 or higher (previously 1.4.5) and includes \ex\_doc\ as a development dependency to enable documentation generation. The \mix.lock\ file was added to pin specific versions for documentation tools including \ex\_doc\, \earmark\, \earmark\_parser\, \makeup\, \makeup\_elixir\, \makeup\_erlang\, and \nimble\_parsec\.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 58.

Lenses

  • Code Health 99
  • Architecture 69
  • Maturity 59
  • Readiness 43
  • Security 100

Changes since last survey

  • 104 commits — 87 feature/other, 17 fixes

By area

  • (root) — 61 commits
  • lib/memoize — 20 commits
  • (repo) — 11 commits
  • lib/memoize.ex — 7 commits
  • bench/lib — 3 commits
  • test/memoize_cache_test.exs — 1 commit
  • test/memoize_test.exs — 1 commit

Notable commits

  • fix: Fix #13
  • fix: Fix deadlock when max_waiters die
  • fix: Fix double-calling of normalize_key
  • fix: Merge pull request #14 from davorbadrov/fix/caching_process_lock
  • fix: Merge pull request #22 from phanmn/dev-fix-invalidate-cache
  • fix: Merge pull request #32 from katafrakt/fix-double-normalize-key
  • fix: fix defmemo unquote(name) doesn't work (#2)
  • fix: fix a document
  • fix: fix a warning for elixir 1.5.0
  • fix: fix block process if max_waiters == 0
  • fix: fix do not work using the pattern match
  • fix: fix docs
  • fix: fix infinite loop if cache process crashes
  • fix: fix opts is not passed at retrying get_or_run
  • fix: fix test
  • fix: fix wrong expected value
  • fix: fix: Invalidate cache with map
  • change: Add benchmarks
  • change: Add the default value of :expires_in configurable.
  • change: Clear expiration_tab when invalidating or garbage collecting
  • …and 84 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

melpon/memoize was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 50268cf2f20853170b59374dcacff51f87f8d171 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.