module Rotor::Cache

The translations of the queries' blocks, kept for the process: a call whose block was translated over the same models, with captures of the same kinds (Guard), takes the translation kept and fills in its parameters. At most LIMIT entries per key, never evicted: the kinds of several captures multiply (nil or not, a class, an array's items' class; not an array's length, which the SQL does not depend on), so a kind beyond them is translated on each build, as before the cache, and not kept.

/home/runner/work/rotor/rotor/src/cache.qz:231

Constants

LIMIT: Int

The entries a key keeps at most.

/home/runner/work/rotor/rotor/src/cache.qz:233

CONDITIONS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[Rotor::Sql]]]]

/home/runner/work/rotor/rotor/src/cache.qz:234

ORDERS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[Rotor::Sql]]]]

/home/runner/work/rotor/rotor/src/cache.qz:235

PLANS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[Rotor::InnerPlan]]]]

/home/runner/work/rotor/rotor/src/cache.qz:236

READS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[Array[Array[Rotor::Column]?]]]]]

/home/runner/work/rotor/rotor/src/cache.qz:237

ASSOCIATIONS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[[Rotor::Association, Symbol]]]]]

/home/runner/work/rotor/rotor/src/cache.qz:238

SETS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[Array[Rotor::Piece]]]]]

/home/runner/work/rotor/rotor/src/cache.qz:239

PRELOADS: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[Array[Rotor::Preload]]]]]

/home/runner/work/rotor/rotor/src/cache.qz:240

MADE: Atom[Int]

How many translations were made (not taken from the cache): for tests.

/home/runner/work/rotor/rotor/src/cache.qz:243

Class methods

def self.translations -> Int

The number of translations made so far (a call the cache served adds none).

/home/runner/work/rotor/rotor/src/cache.qz:247

def self.key(site: Int, sources: Array[Rotor::Source]) -> Rotor::CacheKey

The key of a block of site site over sources.

/home/runner/work/rotor/rotor/src/cache.qz:250

def self.fetch[V <: Shareable](atom: Atom[Hash[Rotor::CacheKey, Array[Rotor::Cached[V]]]], key: Rotor::CacheKey, captures: Array[Object], &make: () -> [V, Array[Rotor::Guard]]) -> V

What atom keeps for key whose guards hold of captures, or else the block's (a translation, its guards), then kept if the key has room (LIMIT).

/home/runner/work/rotor/rotor/src/cache.qz:255