Storage
Storage (in most cases persistent) that holds data items. Collection of items are organized in named StorageTables.
Concurrency and Multiple Instances
It is safe to use multiple Storage instances that reference the same underlying database concurrently, whether within the same process or across different processes (for example, a mobile application and an app extension sharing an App Group container).
Implementations provide concurrency guarantees through the underlying database engine:
Atomicity: Individual operations on StorageTable (such as
insert,update,delete, andget) are atomic.Contention Handling: When multiple connections or processes attempt to access or modify the database simultaneously, implementations configure appropriate lock wait mechanisms (e.g., SQLite's
busy_timeouton mobile platforms, transaction queues in IndexedDB, or MVCC in relational databases). Operations will automatically wait for concurrent locks to be released rather than immediately failing with contention errors. If contention persists longer than the configured timeout, the operation will fail with an exception.