IndexedDB implementation in Firefox 26 (the current beta) supports a new storage type called temporary storage. In short, it's a storage with LRU eviction policy, so the least recently used data is automatically deleted when a limit is reached. Chrome supports something similar [1].
Obviously, the IndexedDB spec needs to be updated to allow specifying different storage types. We might need to add other parameters in future so we propose creating a dictionary with a "version" and "storage" property for now. Here is the current interface: interface IDBFactory { IDBOpenDBRequest open (DOMString name, [EnforceRange] optional unsigned long long version); IDBOpenDBRequest <https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBOpenDBRequest> deleteDatabase (DOMString name); short cmp (any first, any second); }; and the interface with the dictionary: interface IDBFactory { IDBOpenDBRequest open (DOMString name, [EnforceRange] unsigned long long version); IDBOpenDBRequest open (DOMString name, optional IDBOpenDBOptions options); IDBOpenDBRequest deleteDatabase (DOMString name, optional IDBOpenDBOptions options); short cmp (any first, any second); }; enum StorageType { "persistent", "temporary" }; dictionary IDBOpenDBOptions { [EnforceRange] unsigned long long version; StorageType storage; }; Some simple examples: Example 1a - Opening a database in default storage: var request = indexedDB.open('AddressBook', 15); request.onsuccess = function(evt) {...}; request.onerror = function(evt) {...}; Example 1b - Deleting a database in default storage: var request = indexedDB.deleteDatabase("AddressBook");request.onsuccess = function(evt) {...}; request.onerror = function(evt) {...}; Example 2a - Opening a database in temporary storage: var request = indexedDB.open("AddressBook", { version: 15, storage: "temporary" });request.onsuccess = function(evt) {...}; request.onerror = function(evt) {...}; Example 2b - Deleting a database in temporary storage: var request = indexedDB.deleteDatabase("AddressBook", { storage: "temporary" });request.onsuccess = function(evt) {...}; request.onerror = function(evt) {...}; What do you think ? [1] https://developers.google.com/chrome/whitepapers/storage Jan