aws_encryption_sdk.caches

Common functions and structures for use in cryptographic materials caches.

New in version 1.3.0.

Functions

build_decryption_materials_cache_key(…)

Generates a cache key for a decrypt request.

build_encryption_materials_cache_key(…)

Generates a cache key for an encrypt request.

Classes

CryptoMaterialsCacheEntry(cache_key, value)

Value and metadata store for cryptographic materials cache entries.

CryptoMaterialsCacheEntryHints([lifetime])

Optional metadata to associate with cryptographic materials cache entries.

aws_encryption_sdk.caches.build_encryption_materials_cache_key(partition, request)

Generates a cache key for an encrypt request.

Parameters
Returns

cache key

Return type

bytes

aws_encryption_sdk.caches.build_decryption_materials_cache_key(partition, request)

Generates a cache key for a decrypt request.

Parameters
Returns

cache key

Return type

bytes

class aws_encryption_sdk.caches.CryptoMaterialsCacheEntryHints(lifetime=None)

Bases: object

Optional metadata to associate with cryptographic materials cache entries.

Parameters

lifetime (float) – Number of seconds to retain entry in cache (optional)

class aws_encryption_sdk.caches.CryptoMaterialsCacheEntry(cache_key, value, hints=NOTHING)

Bases: object

Value and metadata store for cryptographic materials cache entries.

Parameters
property age

Returns this entry’s current age in seconds.

Return type

float

is_too_old()

Determines if if this entry’s lifetime has passed.

Return type

bool

invalidate()

Marks a cache entry as invalidated.