Memory Module API Reference¶
This section documents the internals of the memory
module in Bijux CLI.
bijux_cli.contracts.memory ¶
Defines the contract for the transient in-memory key-value service.
This module specifies the MemoryProtocol
, a formal interface that any service providing a non-persistent, in-memory key-value store must implement. This is used for managing ephemeral state within the CLI.
MemoryProtocol ¶
Bases: Protocol
Defines the contract for a simple in-memory key-value store.
This interface specifies the essential methods for a basic key-value data storage service. It is used for managing ephemeral state within the CLI that does not need to persist across sessions.
clear ¶
delete ¶
Deletes a key-value pair by its key.
Parameters:
-
key
(str
) –The key of the value to delete.
Raises:
-
KeyError
–If the key does not exist in the store.
get ¶
Retrieves a value by its key.
Parameters:
-
key
(str
) –The key of the value to retrieve.
Returns:
-
Any
(Any
) –The value associated with the key.
Raises:
-
KeyError
–If the key does not exist in the store.
Source code in src/bijux_cli/contracts/memory.py
keys ¶
Returns a list of all keys currently in the store.
Returns:
-
list[str]
–list[str]: A list of all string keys.
set ¶
Sets a key-value pair in the store.
If the key already exists, its value will be overwritten.
Parameters:
-
key
(str
) –The key for the value being set.
-
value
(Any
) –The value to store.
Returns:
-
None
(None
) –