Skip to main content
Module

x/proc/mod.ts>cache

A better way to work with processes in Deno.
Go to Latest
function cache
import { cache } from "https://deno.land/x/proc@0.21.6/mod.ts";

fetch and put in one step.

Example

const peerings = await cache.cache(
  "vpc-peerings",
  async () => await proc.enumerate(allPeerings()).collect(),
  { timeout: 4 * HOURS },
);

Parameters

key: string | string[]

The cache key.

value: () => T | Promise<T>

The value function. This is called to fill the cache if needed.

optional
options: { timeout?: number; }

Options. Timeout in milliseconds.