SmartCache class

L1 (SIEVE memory) + L2 (CompactCache disk) + ZLib compression + offline queue.

Research basis:

  • SIEVE eviction (NSDI '24): FIFO + visited bit, lazy promotion. 2x throughput vs LRU, no lock on cache hits.
  • Append-only log (WAL pattern): single-file L2 instead of 1-file-per-doc.
  • ZLib level 1 compression: built-in Dart, ~2-3x ratio, fast encode.

Constructors

SmartCache({required CacheStrategy cache, required String queueDir, required WsChannel wsChannel, bool enableCompression = true})

Properties

deniedOperations → Stream<String>
no setter
enableCompression → bool
final
flushResults → Stream<FlushResult>
no setter
hashCode → int
The hash code for this object.
no setterinherited
pendingCount → int
no setter
ready → Future<void>
Waits until the offline queue has been loaded from disk. Call this before the first flushQueue() to avoid racing.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
enqueueDelete(String blockId) → Future<void>
enqueueIndexedPut(String blockId, Uint8List data, List<({int fieldHash, int tagHash, Uint8List valueBytes})> entries) → Future<void>
enqueuePut(String blockId, Uint8List data) → Future<void>
evict(String key) → Future<void>
flushQueue() → Future<FlushResult>
Flushes the offline queue to the server.
get(String key) → Future<Uint8List?>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String key, Uint8List data, {bool isLocal = false}) → Future<void>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited