Skip to content

Latest commit

 

History

History
99 lines (68 loc) · 4.52 KB

local-cryptographic-materials-cache.md

File metadata and controls

99 lines (68 loc) · 4.52 KB

Local Cryptographic Materials Cache

Version

Changelog

Implementations

Language Confirmed Compatible with Spec Version Minimum Version Confirmed Implementation
C n/a n/a local_cache.c
Javascript 0.1.0 0.1.0 get_local_cryptographic_materials_cache.ts
Python n/a n/a caches/local.py
Java 0.1.0 1.3.0 LocalCryptoMaterialsCache.java

Overview

The local Cryptographic Materials Cache (local CMC) is a built-in implementation of the CMC interface provided by the AWS Encryption SDK. The local CMC is a configurable, in-memory, least recently used (LRU) cache. It provides atomic access to cache entries per cache identifier.

Definitions

Conventions used in this document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Initialization

On initialization of the local CMC, the caller MUST provide the following:

The local CMC MUST also define the following:

Entry Capacity

The entry capacity is the maximum size of the local CMC in terms of cache entries. The local CMC MUST NOT store more entries than this value, except temporarily while performing a Put Cache Entry operation. The local CMC MUST accept entry capacity values between zero and an implementation-defined maximum, inclusive.

Entry Pruning Tail Size

The entry pruning tail size is the number of least recently used entries that the local CMC MUST check during pruning for TTL-expired entries to evict.

Behaviors

Put Cache Entry

When performing a Put Cache Entry operation, the local CMC should not prune TTL-expired cache entries. This is because an entry is added after a get miss. A prune happens during the get operation.

While performing a Put Cache Entry operation, the local CMC MAY store more entries than the entry capacity. However, before returning, the local CMC MUST evict least-recently used entries until the number of stored entries does not exceed the entry capacity.

Get Cache Entry

When performing a Get Cache Entry operation, the local CMC MUST prune TTL-expired cache entries. The local CMC MUST NOT return any TTL-expired entry.

Pruning

To prune TTL-expired cache entries, the local CMC MUST evict all TTL-expired entries among the N least recently used entries, where N is the Entry Pruning Tail Size. This means that a maximum of N entries and a minimum of 0 entries will be evicted.

The local CMC SHOULD also periodically evict all TTL-expired entries among the N least recently used entries.