Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TokenMemoryCache #2137

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gretchenfrage
Copy link
Collaborator

Implements TokenMemoryCache, and makes it the default TokenStore for clients.

TokenMemoryCache is a new implementation of TokenStore.

TokenMemoryCache is designed to store up to 2 tokens per server (this is
configurable) for up to 256 servers (this is also configurable), with a
LRU eviction policy. This is so that it works harmoniously with
rustls::ClientSessionMemoryCache, which by default stores resumption
state for up to 256 servers with a LRU eviction policy.

Although this does create a complex intrusive structure, this commit
contains unit tests which assert that it maintains not only the same
external behavior but also isomorphic internal structure to an oracle
implementation based on stdlib types, under a large number of
deterministically randomized operations. This should give us a high
degree of assurance against implementation errors.
Deletes SimpleTokenStore. Test code can now rely on TokenMemoryCache,
which is set by default.
@gretchenfrage gretchenfrage marked this pull request as ready for review January 26, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant