Blogs›Modal›Serverless Key-Value Store (Dict)
Serverless Key-Value Store (Dict)
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.