This PR adds a property to SqliteKeyValueStoreOptions for defining a background flush interval.
When the interval is greater than TimeSpan.Zero, write and delete operations are no longer immediately performed. Instead, they are added to a dictionary (indexed by key). The value for the entry is the byte array for the updated value, or null if the key should be deleted.
When the flush interval is reached, a background task performs all of the pending changes and clears the pending operations dictionary. A flush can also be explicitly triggered using the new FlushAsync method on the SqliteKeyValueStore class.
The default behaviour is to write/delete from the database immediately, so the background flush capability is opt-in.
This PR adds a property to
SqliteKeyValueStoreOptions
for defining a background flush interval.When the interval is greater than
TimeSpan.Zero
, write and delete operations are no longer immediately performed. Instead, they are added to a dictionary (indexed by key). The value for the entry is the byte array for the updated value, ornull
if the key should be deleted.When the flush interval is reached, a background task performs all of the pending changes and clears the pending operations dictionary. A flush can also be explicitly triggered using the new
FlushAsync
method on theSqliteKeyValueStore
class.The default behaviour is to write/delete from the database immediately, so the background flush capability is opt-in.