mochi/document_cache

Types

pub opaque type DocumentCache

Values

pub fn get(
  cache: DocumentCache,
  query: String,
) -> Result(@internal Document, Nil)
pub fn new() -> DocumentCache
pub fn new_with_max(max_size: Int) -> DocumentCache
pub fn new_with_min_size(
  max_size: Int,
  min_size: Int,
) -> DocumentCache

Construct a cache with a custom byte-size threshold. Queries below min_size bytes bypass the cache entirely; the parser is fast enough that the ETS roundtrip would cost more than re-parsing.

pub fn put(
  cache: DocumentCache,
  query: String,
  doc: @internal Document,
) -> Nil
pub fn size(cache: DocumentCache) -> Int
Search Document