element.version === currentVersion)) { versionNodes.unshift({ version: currentVersion, url: "#" }); } document.querySelector("#project-version").innerHTML = versionNodes.reduce( (acc, element) => { const status = currentVersion === element.version ? "selected disabled" : ""; return ` ${acc} `; }, `
hardcache · v1.3.2

hardcache

Package Version Hex Docs

Hardcache is a Gleam module that provides primitives for caching key-value pairs in files and using files as caches.

Examples

import hardcache

import gleam/float
import gleam/option

pub fn main() {
  let cache = hardcache.new("./expensive", True)
  case hardcache.try_get(cache, "expensive_calculation") {
    Ok(option.None) -> {
      let _ =
        hardcache.try_set(cache, "expensive_calculation", float.to_string(0.1 +. 0.2))
      Nil
    }
    _ -> Nil
  }
}

Installation

If available on the Hex package manager, you can add hardcache to your project by running the command below:

gleam add hardcache

Further documentation can be found at https://hexdocs.pm/hardcache.

Development

gleam test # Run the tests
Search Document