// Generated by moonkart cached from slow.mbt. Edit those files, not this one.

///|
let square_cached_store : @moonkart.Cache[Int32, Int32] = @moonkart.lru_cache(
  cap=16L,
  expiry=@moonkart.ttl(60000000000L),
)

///|
pub fn square_cached(n : Int32) -> Int32 {
  match square_cached_store.get(n) {
    Some(v) => v
    None => {
      let v = square(n)
      square_cached_store.set(n, v)
      v
    }
  }
}

///|
pub fn square_cached_clear() -> Unit {
  square_cached_store.invalidate_all()
}

///|
let area_cached_store : @moonkart.Cache[(Int32, Int32), Int32] = @moonkart.tinylfu_cache(
  cap=128L,
)

///|
pub fn area_cached(width : Int32, height : Int32) -> Int32 {
  match area_cached_store.get((width, height)) {
    Some(v) => v
    None => {
      let v = area(width, height)
      area_cached_store.set((width, height), v)
      v
    }
  }
}

///|
pub fn area_cached_clear() -> Unit {
  area_cached_store.invalidate_all()
}