Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/proc/tools/deps/proc.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.5/tools/deps/proc.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.