Generated API reference
yak.Dictionary
A distributed dictionary accessible from anywhere.
A distributed dictionary accessible from anywhere.
Dicts provide distributed key-value storage with automatic serialization.
They are scoped to an organization and environment.
provenance
c2e8cf7c309abe376f390072b94a9ecd3e633080Dictionary.from_name#
Get or create a Dictionary by name.
Get or create a Dictionary by name.
from_name(name: str, create_if_missing: bool = False, environment_name: Optional[str] = None) -> Dictionary
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
namepositional-or-keyword |
str |
— |
Name of the dictionary |
create_if_missingpositional-or-keyword |
bool |
False |
Create the dictionary if it doesn't exist |
environment_namepositional-or-keyword |
Optional[str] |
None |
Environment name (default: YAK_ENVIRONMENT env var or "development") |
Returns#
DictionaryDictionary instance
Raises#
ValueErrorIf dictionary not found and create_if_missing is False
Dictionary.get#
Get a value with a default.
Get a value with a default.
get(key: str, default: Any = None) -> Any
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
keypositional-or-keyword |
str |
— |
Key to retrieve |
defaultpositional-or-keyword |
Any |
None |
Default value if key not found |
Returns#
AnyValue or default
Dictionary.get_aio#
Get a value asynchronously.
Get a value asynchronously.
get_aio(key: str) -> Any
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
keypositional-or-keyword |
str |
— |
Key to retrieve |
Returns#
AnyDeserialized value
Raises#
KeyErrorIf key not found
Dictionary.put_aio#
Put a value asynchronously.
Put a value asynchronously.
put_aio(key: str, value: Any)
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
keypositional-or-keyword |
str |
— |
Key to set |
valuepositional-or-keyword |
Any |
— |
Value to store (must be JSON-serializable) |
Raises#
ValueErrorIf value is not JSON-serializable
Dictionary.delete_aio#
Delete a key asynchronously.
Delete a key asynchronously.
delete_aio(key: str)
Parameters#
| Name | Type | Default | Description |
|---|---|---|---|
keypositional-or-keyword |
str |
— |
Key to delete |
Raises#
KeyErrorIf key not found
Dictionary.clear_aio#
Clear all entries asynchronously.
Clear all entries asynchronously.
clear_aio()
Dictionary.clear#
Clear all entries in the dictionary.
Clear all entries in the dictionary.
clear()
Related guides
- This page is generated from the pinned release schema; update the site pin when a new release should be documented.
- Lifecycle, persistence and operational context belong in the linked handwritten guides.