Search documentation

Type to search the documentation.

Generated API reference

classyak.Dictionary

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.

Python SDK reference · Yak 0.1.19release v0.1.19
provenancec2e8cf7c309abe376f390072b94a9ecd3e633080
method

Dictionary.from_name#

Get or create a Dictionary by name.

Get or create a Dictionary by name.

Signature
python
from_name(name: str, create_if_missing: bool = False, environment_name: Optional[str] = None) -> Dictionary

Parameters#

NameTypeDefaultDescription
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#

Dictionary

Dictionary instance

Raises#

  • ValueError

    If dictionary not found and create_if_missing is False

method

Dictionary.get#

Get a value with a default.

Get a value with a default.

Signature
python
get(key: str, default: Any = None) -> Any

Parameters#

NameTypeDefaultDescription
keypositional-or-keyword str —

Key to retrieve

defaultpositional-or-keyword Any None

Default value if key not found

Returns#

Any

Value or default

method

Dictionary.get_aio#

Get a value asynchronously.

Get a value asynchronously.

Signature
python
get_aio(key: str) -> Any

Parameters#

NameTypeDefaultDescription
keypositional-or-keyword str —

Key to retrieve

Returns#

Any

Deserialized value

Raises#

  • KeyError

    If key not found

method

Dictionary.put_aio#

Put a value asynchronously.

Put a value asynchronously.

Signature
python
put_aio(key: str, value: Any)

Parameters#

NameTypeDefaultDescription
keypositional-or-keyword str —

Key to set

valuepositional-or-keyword Any —

Value to store (must be JSON-serializable)

Raises#

  • ValueError

    If value is not JSON-serializable

method

Dictionary.delete_aio#

Delete a key asynchronously.

Delete a key asynchronously.

Signature
python
delete_aio(key: str)

Parameters#

NameTypeDefaultDescription
keypositional-or-keyword str —

Key to delete

Raises#

  • KeyError

    If key not found

method

Dictionary.clear_aio#

Clear all entries asynchronously.

Clear all entries asynchronously.

Signature
python
clear_aio()
method

Dictionary.clear#

Clear all entries in the dictionary.

Clear all entries in the dictionary.

Signature
python
clear()

Related guides

Dictionaries
BoundaryPreview limitations
  • 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.