Browser localStorage-based caching library, part of the Falak framework ecosystem. Current stable version: 0.1.67. Provides a simple API (set, get, has, remove, clear) with automatic serialization of objects/arrays, optional encryption of stored values, and configurable expiration using timestamps. Designed for use with DI container; supports ESM/CommonJS. Lightweight, no external dependencies, encrypts values by default via flk-crypto. Differentiates from general caching libraries by deep Falak integration and encryption-at-rest built-in.
npm install flk-coreVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic CRUD operations: set, get, has, remove, clear with object support and expiration.
Set 'encryptValues' to false in flk-config under 'cache' key to disable encryption.
Use Cache.FOR_ONE_HOUR constant or calculate: Date.now() + 3600000.
Use import { getCache } from 'flk-cache'.Use only in browser environment or provide localStorage polyfill for Node.
Install and import flk-core first: import { DI } from 'flk-core'; import 'flk-cache';Use named import: import { getCache } from 'flk-cache';Use a polyfill like 'localstorage-polyfill' or avoid using cache server-side.
Provide a numeric timestamp: cache.set('key', value, Date.now() + 60000);