ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

In-memory cache of translation maps keyed by locale.

Each locale is loaded from disk exactly once; every subsequent lookup resolves from the internal dictionary with O(1) access. The cache is fully transparent to consumers.

Notes

The repository uses no lock. Two tasks missing the cache for the same locale may both call the loader; the last assignment wins and both callers receive a valid map. get returns the cached mapping itself, not a copy, so mutating it mutates the cache for every consumer.

Method __init__ Initialize the repository with its translation loader.
Method flush Discard every cached translation map.
Method forget Discard the cached translations for locale.
Method get Return the translation map for locale, loading it on demand.
Method has Determine whether locale is already cached in memory.
Method loadedLocales Return the locales currently held in the cache.
Class Variable __slots__ Undocumented
Instance Variable _cache Undocumented
Instance Variable _loader Undocumented
def __init__(self, loader: ITranslationLoader): (source)

Initialize the repository with its translation loader.

Parameters
loader:ITranslationLoaderLoader used to read translation sources on cache misses.
Returns
NoneUndocumented
def flush(self): (source)

Discard every cached translation map.

Returns
NoneUndocumented
def forget(self, locale: str) -> bool: (source)

Discard the cached translations for locale.

Parameters
locale:strLocale code whose cache entry must be removed.
Returns
boolTrue when an entry was removed, False otherwise.
def get(self, locale: str) -> TranslationMap: (source)

Return the translation map for locale, loading it on demand.

Parameters
locale:strLocale code whose translations are requested.
Returns
TranslationMapCached translation map for the locale. The mapping is the cached instance, not a copy.
Raises
TranslationSyntaxExceptionIf a translation file contains invalid JSON.
def has(self, locale: str) -> bool: (source)

Determine whether locale is already cached in memory.

Parameters
locale:strLocale code to check.
Returns
boolTrue when the locale is present in the cache.
def loadedLocales(self) -> tuple[str, ...]: (source)

Return the locales currently held in the cache.

Returns
tuple[str, ...]Locale codes present in the in-memory cache.
_cache: LocaleCache = (source)

Undocumented

Undocumented