blossom_cache 0.5.0 copy "blossom_cache: ^0.5.0" to clipboard
blossom_cache: ^0.5.0 copied to clipboard

A network-free local Blossom blob store for Dart. Works on web, native, and server.

0.5.0 #

  • Pins are now held per holder. pin(sha256, by: holder) and unpin(sha256, by: holder) add or release one holder's pin, and a blob stays protected from eviction until every holder has released it. by defaults to BlossomCache.defaultHolder, so pin(sha) and unpin(sha) keep working for single-consumer apps.
  • Add BlossomCache.unpinAll(holder) to release every pin a holder has, e.g. on per-account logout. Returns the number of blobs that lost a pin.
  • Add BlobDescriptor.pinnedBy. BlobDescriptor.pinned is now a getter, true when pinnedBy is not empty.
  • Re-putting an existing blob now keeps its pins instead of resetting them.
  • Breaking: put(pinned: true) is replaced by put(pinBy: holder). Migration: put(bytes, pinned: true) → put(bytes, pinBy: BlossomCache.defaultHolder).
  • Breaking: the BlobDescriptor constructor takes pinnedBy: instead of pinned:.
  • Breaking (implementers only): custom BlossomCache implementations must accept by in pin/unpin and provide unpinAll.
  • Blobs pinned by earlier versions are read as pinned by BlossomCache.defaultHolder. No schema change, nothing is dropped.

0.4.0 #

  • Add BlossomCache.clearAllLocalData(), which wipes every blob and its metadata (pinned ones included) and leaves the cache usable. On IdbBlossomCache it clears both object stores in a single transaction, so it also reclaims any orphaned chunk.
  • Breaking (implementers only): custom BlossomCache implementations must now provide clearAllLocalData. Callers of the built-in caches are unaffected.

0.3.0 #

  • Fix Android CursorWindow ~2 MB row limit when idb_shim is backed by sqflite: IdbBlossomCache now stores blobs as fixed-size chunks instead of a single row, so blobs larger than ~2 MB round-trip correctly on Android.
  • Add chunkSize parameter to IdbBlossomCache.open() (default 1 MB). Raise it on web for fewer round-trips, lower it for constrained devices.
  • Breaking (on-disk): database schema bumped to version 2. Caches written by 0.2.0 and earlier are dropped on first open with this version; the API is unchanged.

0.2.0 #

  • Breaking: BlossomCache.put now takes bytes as the only positional argument; the hash moves to an optional sha256: named parameter. When omitted, the cache computes the sha256 from the bytes via package:crypto. Migration: cache.put(sha, bytes) → cache.put(bytes, sha256: sha), or drop the sha256: argument entirely to let the cache hash it.
  • Add crypto: ^3.0.7 dependency.

0.1.0 #

  • Initial version.
1
likes
160
points
261
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A network-free local Blossom blob store for Dart. Works on web, native, and server.

Repository (GitHub)
View/report issues

Topics

#blossom #nostr #cache #storage #blob

License

MIT (license)

Dependencies

crypto, idb_shim

More

Packages that depend on blossom_cache