UNPKG

mastercache

Version:

Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers

15 lines (12 loc) 319 B
import type { CacheSerializer } from '../types/main'; /** * Simple class to serialize and deserialize values using JSON */ export class JsonSerializer implements CacheSerializer { serialize(value: unknown) { return JSON.stringify(value); } deserialize(value: string) { return JSON.parse(value); } }