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
+5 -6
View File
@@ -1,6 +1,11 @@
defmodule Chesstrainer.Endgames.Tablebase do
@moduledoc """
All endgame tablebase related functions.
The cached value carries only what the trainer reads: `category`,
`checkmate`, and `moves` drive play, while `dtm`/`dtc` are small distance
hedges. Cursed-win/blessed-loss are normalised to `:draw` at parse time, so
the raw `dtw`/`dtz`/`insufficient_material` fields are not kept here.
"""
alias Chesstrainer.Endgames.Tablebase
@@ -12,9 +17,6 @@ defmodule Chesstrainer.Endgames.Tablebase do
checkmate: boolean(),
dtc: integer() | nil,
dtm: integer() | nil,
dtw: integer() | nil,
dtz: integer() | nil,
insufficient_material: boolean(),
moves: [Tablebase.Move.t()]
}
@@ -22,9 +24,6 @@ defmodule Chesstrainer.Endgames.Tablebase do
checkmate: false,
dtc: nil,
dtm: nil,
dtw: nil,
dtz: nil,
insufficient_material: false,
moves: nil
@doc """