cacheman 0.5.0
cacheman: ^0.5.0 copied to clipboard
A tiny, type-safe wrapper over get_storage (persistent) with one unified API: TTL & absolute expiry, sliding renewal, namespaces, pluggable serialization, an optional codec hook, and a key-bound short [...]
0.5.0 #
Breaking:
-
Removed
Cacheman.create().Cachemannow has a plain, synchronous constructor (Cacheman({container, path, options})) plus an instance methodensureInitialized()that must be called and awaited once before any read/write — the onlyFutureboundary in the API, same rolecreate()used to play. This lets external codeextend Cachemanand forward constructor params viasuper(...)without any factory boilerplate (Dart constructors can't beasync, which is whycreate()— a static factory — couldn't be subclassed cleanly).Migration:
final cache = await Cacheman.create(options: opts);→final cache = Cacheman(options: opts); await cache.ensureInitialized();
0.4.0 #
- Added
Cacheman.container— exposes the underlyingget_storageGetStorageinstance, for interop that needs the raw container (e.g.listenKeyfor external change notifications, such as wiring up a GetXRxfor reactive reads). - Added
Cacheman.storageKey(key)— returns the actual keykeyis persisted under (namespace-prefixed, andenckey-encoded when enabled). Needed alongsidecontainersince the real storage key is otherwise opaque onceenckey's pluggable codec is involved.
0.3.0 #
Breaking:
- Removed the
StoreandMemoCacheabstraction layers.Enginenow talks directly to aGetStoragecontainer and a plainMapread cache instead of going through an injected backend/memo-cache interface — both only ever had one real implementation (GetStorageAdapter/Memo), so the seam was pure indirection.GetStorageAdapterandMemo(and their fileslib/src/get_storage_adapter.dart/lib/src/memo.dart) are deleted.Store/MemoCache/Memowere previously part of the public export surface (package:cacheman/cacheman.dart) — any code importing them directly will no longer compile. This is an internal simplification with no behavioral change toCacheman's public API (read/write/remove/erase/... are unaffected). - Removed the in-process memo read-cache layer entirely. Every
readnow goes straight toget_storage; everywritepersists straight toget_storage, with no intermediate cache.CachemanOptions.memoized,CacheOptions.memoized,CachemanOptions.cloned, andCachemanOptions.deepClonedare all removed (there is no longer a shared memo reference forcloned/deepClonedto protect against — everyread()already returns a value freshly deserialized from JSON, never aliased to anything the engine holds onto).Engine.destroy()andCacheman.destroy()are removed — with no memo cache,destroy()had nothing left to do. - Merged the
Engineclass directly intoCacheman—Cachemanwas already a pure forwarding wrapper aroundEnginewith no other consumers, so the two are now one class (lib/src/cacheman.dart);lib/src/engine.dartis deleted, andCacheOptions/CachemanOptionsmoved tolib/src/options.dart. This is an internal simplification with no behavioral change toCacheman's public API, but it is breaking for anyone who imported theEnginetype directly (it was previously exported frompackage:cacheman/cacheman.dart) — that export is removed, since nothing outside the package ever constructed anEngineon its own.
0.2.0 #
Breaking:
ssin-memory tier removed; only the persistentlstier remains.Cacheman.create()no longer accepts acapparameter, andCacheman.ss/Memoryno longer exist.Engine's core CRUD methods renamed:get/getAll→read/readAll,set/setAll→write/writeAll,clear→erase.remove/removeAllare unchanged.Cacheman.lsremoved.Cachemannow exposesEngine's whole public API directly at the top level (read/readAll,write/writeAll,remove/removeAll,erase,key/keys/length/purge/namespace) — callcache.write(...)/cache.read(...)etc. instead ofcache.ls.write(...)/cache.ls.read(...).fast/lazy/batchFast/debug()now take aCachemaninstead of anEngine(fast<String>(cache, 'token'),debug(cache)).
0.1.0 #
Initial version — a get_storage-backed persistent tier (ls) plus a pure in-memory tier (ss),
sharing one engine: TTL & absolute expiry, sliding renewal, namespaces, pluggable serialization, an
optional Codec hook (no implementation shipped), batch get/set/remove, raw/readonly modes,
fast/lazy/batchFast key-bound accessors, a debug() snapshot helper, an optional ss capacity cap
(cap, FIFO eviction), and a generic Jsonx serializer round-tripping DateTime/Duration/Set/
BigInt/Uri/RegExp. The Dart/Flutter sibling of @codejoo/storage.