package require kvstore kvstore::create db key value kvstore::modify db key new-value kvstore::remove db key set value [kvstore::get db key] set keys [kvstore::listKeys db] set kvdict [dvstore::listAll db]
The key value store API, kvstore, provides access to the key value store table in a manager configuration database.
A key value store can be thought of as an array whose keys are strings. The manager key value store is string valued. Associated with each key is a string value. A kvstore package provides the abiliy directly access the key value store in the configuration SQLite3 database file.
Using the API, you can create a new key/value pair. Your application can read existing keys and modify their values. Finally, you can also remove an existing key/value pair from the store.
In the list of public entries that follow,
The db
parameter is an
SQLite3 database connection command that's associated
with the manager configuration database that contains
the kvstore you wish to use.
Creates a new entry in the key value store with
key named key
and an initial
value value
If there is already a key named key
in the database, an error is signalled.
Modifies the value of the existing key
setting it to new-value
.
If key
does not yet exist,
an error will be signalled.
Removes the existing key
from the key value store. If key
was not yet defined, an error is signalled.
Returns the value
associated with the key
.
If the key
is not defined,
an error is signalled.
Lists the keys defined in the key value store. It is not an error to invoke this when no keys are defined. If that is the case an empty list is returned.
Returns a dict whose keys are all of the defined keys in the key value store and whose values are the values of those keys.