protocols.kvstore.KeyValueStoreProtocol

A protocol for a key-value store.

Usage

Source

protocols.kvstore.KeyValueStoreProtocol()

Methods

Name Description
delete() Delete the value for the given key.
exists() Check if the given key exists.
get() Retrieve the value for the given key.
set() Set the value for the given key.

delete()

Delete the value for the given key.

Usage

Source

delete(key)

Does nothing if there is no such value in the store.


exists()

Check if the given key exists.

Usage

Source

exists(key)

Default implementation for classes inheriting from this protocol. Providers can use something more efficient.


get()

Retrieve the value for the given key.

Usage

Source

get(key, default=None)

Returns the specified default value if there is no such value in the store.


set()

Set the value for the given key.

Usage

Source

set(key, value)

Providers must reject storing a value of None if they support a value domain V that can contain such values.