class documentation
class PureFileCacheBearer(ParentBearer): (source)
Constructor: PureFileCacheBearer(name, cache_file, throttle)
Bearer that exposes a PureFileCacheReceiver for a named
token.
Notes
Construction is inexpensive; the cache performs I/O lazily when tokens are accessed via the receiver.
Example
Create a bearer that reads credentials from the default credentials file and caches them for five minutes:
from nebius.aio.token.file_cache.file_bearer import PureFileCacheBearer
from nebius.sdk import SDK
bearer = PureFileCacheBearer('my-service')
sdk = SDK(credentials=bearer)
| Parameters | |
| name | Logical name for the credential. |
| cache | Destination YAML file used to persist tokens. |
| throttle | Throttle interval for in-memory caching. |
| Method | __init__ |
Create a bearer backed by a throttled file cache. |
| Method | receiver |
Return a PureFileCacheReceiver bound to the cache. |
| Property | name |
Return the logical name for this bearer. |
| Instance Variable | _cache |
Undocumented |
| Instance Variable | _name |
Undocumented |
Inherited from Bearer:
| Async Method | close |
Close the bearer and any wrapped resources. |
| Property | wrapped |
Return the wrapped bearer or None if not wrapping. |
def __init__(self, name: DEFAULT_CONFIG_DIR) / DEFAULT_CREDENTIALS_FILE, throttle: minutes=5)):
(source)
¶
str, cache_file: str | Path = Path(timedelta | float = timedelta(Create a bearer backed by a throttled file cache.
overrides
nebius.aio.token.token.Bearer.receiverReturn a PureFileCacheReceiver bound to the cache.
Each call returns a fresh receiver that references the same
ThrottledTokenCache instance.
| Returns | |
ParentReceiver | A receiver that reads from the shared cache. |
overrides
nebius.aio.token.token.Bearer.nameReturn the logical name for this bearer.
| Returns | |
| The name provided at construction. |