BlogsModalServerless Key-Value Store (Dict)

Serverless Key-Value Store (Dict)

Serverless Key-Value Store (Dict)

1
posts
2025

Modal's Dict primitive, a serverless TTL'ed key-value store accessible from any container within a workspace, has been significantly enhanced. New Dicts now offer unlimited storage, a revised expiry policy (7 days since last read or write), and introduce a locking primitive via the `.put()` method's `skip_if_exists` flag. Data durability has also been added. These improvements enable advanced use cases like LRU-like caching with extended TTLs for hot entries and distributed locking for 'exactly once' semantics in redundant operations. The post demonstrates building a request cache that leverages these new features to de-duplicate and cache expensive function call results, reducing backend load and improving customer experience.

2025

Modal's serverless KV store gets its limit raised to infinity

5/20/2025

Introduced unlimited storage for Dicts, changed item expiry to 7 days since last read or write, added data durability, and implemented a locking primitive via the `skip_if_exists` flag on `.put()`. This enables advanced caching and de-duplication patterns for serverless workloads.