News

TriFrost 0.3.0

Saturday, May 10, 2025|peterver

Added

  • misc: Migrate existing tests using node assertion to vitest
  • misc: Add test runs to CI for both node (20, 22) and bun runtime jobs
  • misc: Add coverage reporting to codecov to CI
  • misc: Add tests for KV, Redis, Memory, DurableObject storage modules
  • deps: vitest (dev dependency)
  • deps: @vitest/coverage-v8 (dev dependency)

Improved

  • feat: MemoryStore now has built-in LRU capabilities that work seamlessly with the built-in TTL behaviors. These are not enabled by default and can be enabled by passing max_items options.
  • feat: MemoryCache (which runs on MemoryStore) will now by default act as an LRU (least-recently-used) cache, in addition to ttl-based. By default any MemoryCache instance will now be limited to 1000 entries and automatically evicted when its size grows above that (based on least recently used). You can configure this behavior by passing the optional max_items option which allows you to configure the MemoryCache's max item limit. For example:
  • /**
     * Default capped to 1000 entries.
     */
    new MemoryCache();
    
    /**
     * Capped to 500 entries.
     */
    new MemoryCache({max_items: 500});
    
    /**
     * Of course can be combined with existing gc interval.
     * Capped to 500 entries with garbage collection interval checks every second
     */
    new MemoryCache({max_items: 500, gc_interval: 1_000});

Fixed

  • Fixed an issue in KV storage module where set would not work due to a conflicting object vs array conditional check
  • Fixed an issue in Redis storage module where set would not work due to a conflicting object vs array conditional check

Removed

  • deps: nyc (as no longer in use)