Registry / storage / ut-cache

ut-cache

JSON →
library6.0.1jsnpmunverified

A caching module for the UT framework. Current stable version is 6.0.1. Release cadence follows the UT monorepo releases. Key differentiator: tightly integrated with the UT ecosystem for cache management in Node.js applications.

npm install ut-cache
INSTALL
IMPORT
SIG · UT-CACHE
U
ut-cache
storagejavascriptv6.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import cache from 'ut-cache'
const cache = require('ut-cache')
Package is ESM-only; no CommonJS exports. Use import statement.
Cache
import { Cache } from 'ut-cache'
import Cache from 'ut-cache'
Named export for the Cache class, not default. Requires destructured import.
createCache
import { createCache } from 'ut-cache'
import createCache from 'ut-cache'
Factory function is a named export.

Shows basic usage of createCache to instantiate a cache with TTL, and set/get/has/delete/clear operations.

import { createCache } from 'ut-cache'; const cache = createCache({ ttl: 60000 }); // Set a value cache.set('key', 'value'); // Get a value const value = cache.get('key'); console.log(value); // 'value' // Check if key exists if (cache.has('key')) { console.log('Key exists'); } // Delete a key cache.delete('key'); // Clear all cache cache.clear();
Debug
Known issues
breakingESM-only: package no longer supports CommonJS require().
fix
Use import statements instead of require().
affects: >=6.0.0
deprecatedAs of version 6.0.0, the default export has been replaced with named exports (Cache, createCache).
fix
Use named imports like import { Cache } from 'ut-cache'.
affects: >=6.0.0
gotchaUnix timestamp vs Date object: set() and get() return Unix timestamps as numbers, not Date objects.
fix
Convert timestamps with new Date(timestamp) if needed.
affects: >=6.0.0
gotchaAsync not supported: all methods are synchronous. Do not await cache methods.
fix
Call methods synchronously.
affects: >=6.0.0
Errors
Common errors & fixes
TypeError: cache.default is not a function
Using default import when package only exports named exports.
fix
Use import { createCache } from 'ut-cache' instead.
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() on ESM-only package.
fix
Use import statement or upgrade to Node.js with --experimental-require-module.
TypeError: cache.set is not a function
Cache instance not created correctly; variable holds undefined or wrong object.
fix
Ensure createCache() is called and assigned: const cache = createCache({...});
Upgrade
Version history
6.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
30 hits · last 30 days
node
26
OpenAI (training)
1
Resources