I would like to propose adding a new objectFreeze option to the LRUCache configuration, allowing cached objects to be frozen using Object.freeze. This would help prevent accidental mutations of cached data, increasing code safety, especially in scenarios where immutability is crucial.
import { LRUCache } from 'lru-cache'
const cache = new LRUCache({objectFreeze: process.env.NODE_ENV !== 'production'})
cache.set('key', { a: 1 })
const obj = cache.get('key');
obj.a = 2; // thrown error!!