b2sdk._internal.cache

class b2sdk._internal.cache.AbstractCache[source]

Bases: object

clear()[source]
abstract get_bucket_id_or_none_from_bucket_name(name)[source]
abstract get_bucket_name_or_none_from_allowed()[source]
abstract get_bucket_name_or_none_from_bucket_id(bucket_id)[source]
Parameters:

bucket_id (str) –

Return type:

Optional[str]

abstract list_bucket_names_ids()[source]

List buckets in the cache.

Return type:

list[tuple[str, str]]

Returns:

list of tuples (bucket_name, bucket_id)

abstract save_bucket(bucket)[source]
abstract set_bucket_name_cache(buckets)[source]
class b2sdk._internal.cache.DummyCache[source]

Bases: AbstractCache

A cache that does nothing.

get_bucket_id_or_none_from_bucket_name(name)[source]
get_bucket_name_or_none_from_bucket_id(bucket_id)[source]
Parameters:

bucket_id (str) –

Return type:

Optional[str]

get_bucket_name_or_none_from_allowed()[source]
list_bucket_names_ids()[source]

List buckets in the cache.

Return type:

list[tuple[str, str]]

Returns:

list of tuples (bucket_name, bucket_id)

save_bucket(bucket)[source]
set_bucket_name_cache(buckets)[source]
class b2sdk._internal.cache.InMemoryCache[source]

Bases: AbstractCache

A cache that stores the information in memory.

__init__()[source]
get_bucket_id_or_none_from_bucket_name(name)[source]
get_bucket_name_or_none_from_bucket_id(bucket_id)[source]
Parameters:

bucket_id (str) –

Return type:

Optional[str]

get_bucket_name_or_none_from_allowed()[source]
list_bucket_names_ids()[source]

List buckets in the cache.

Return type:

list[tuple[str, str]]

Returns:

list of tuples (bucket_name, bucket_id)

save_bucket(bucket)[source]
set_bucket_name_cache(buckets)[source]
class b2sdk._internal.cache.AuthInfoCache(info)[source]

Bases: AbstractCache

A cache that stores data persistently in StoredAccountInfo.

Parameters:

info (AbstractAccountInfo) –

__init__(info)[source]
Parameters:

info (AbstractAccountInfo) –

get_bucket_id_or_none_from_bucket_name(name)[source]
get_bucket_name_or_none_from_bucket_id(bucket_id)[source]
Return type:

Optional[str]

get_bucket_name_or_none_from_allowed()[source]
list_bucket_names_ids()[source]

List buckets in the cache.

Return type:

list[tuple[str, str]]

Returns:

list of tuples (bucket_name, bucket_id)

save_bucket(bucket)[source]
set_bucket_name_cache(buckets)[source]