Skip to main content

Allo Caching for Deno πŸ¦•

Simple caching solution in Typescript.

Cache<ValueType>

const cache = new Cache<string>();

const cacheKey = 'abc123';

/**
 * Load from cache.
 * If not found, value will be generated and stored in cache.
 */
cache.load(cacheKey, () => {
    const result = 'Lorem ipsum';

    // Some expensive operation
    // ...

    return result
}); // -> string


/**
 * Load from cache.
 */
cache.load(cacheKey); // -> string | undefined


/**
 * Save to cache.
 */
cache.save(cacheKey, 'Lorem ipsum');


/**
 * Check if cache exists.
 */
cache.has(cacheKey); // -> boolean

Documentation πŸ“–

Description of all classes and methods with examples will found in the documentation.


Check out other ours packages πŸ“¦!