Scale the tablebase cache to ~100k entries (#24)

* Slim the cached tablebase value to the fields the trainer reads (#20)

* Sample for LFU eviction instead of scanning the cache (#21)

* Make cache size configurable and back up daily off-peak (#22)

* Document the cache design in the glossary and an ADR (#23)

* Address cache-scaling code review findings
This commit is contained in:
2026-11-02 23:02:01 +01:00
committed by GitHub
parent fa71783e55
commit a5bb1cb670
16 changed files with 695 additions and 120 deletions
+7 -20
View File
@@ -1,41 +1,28 @@
defmodule Chesstrainer.Endgames.Tablebase.Move do
@moduledoc """
Moves struct for the tablebase
Carries only the fields the trainer reads: `category` and `dtz` for grading,
`san`/`uci` for display and matching, and `dtm`/`dtc` as small distance
hedges. Terminal detection is structural (the next position's `checkmate` or
its empty `moves`), so no per-move terminal flags are kept.
"""
@type result :: :win | :draw | :loss | :unknown
@type t :: %__MODULE__{
category: result,
checkmate: boolean(),
conversion: boolean(),
dtc: integer() | nil,
dtm: integer() | nil,
dtw: integer() | nil,
dtz: integer() | nil,
precise_dtz: integer() | nil,
san: String.t() | nil,
stalemate: boolean(),
uci: String.t() | nil,
variant_loss: boolean(),
variant_win: boolean(),
zeroing: boolean(),
insufficient_material: boolean()
uci: String.t() | nil
}
defstruct category: nil,
checkmate: false,
conversion: false,
dtc: nil,
dtm: nil,
dtw: nil,
dtz: nil,
precise_dtz: nil,
san: nil,
stalemate: false,
uci: nil,
variant_loss: false,
variant_win: false,
zeroing: false,
insufficient_material: false
uci: nil
end