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

Implementing an additional caching layer for StoredValue #62

Merged
merged 3 commits into from
Apr 12, 2024
Merged

Conversation

mergesort
Copy link
Owner

StoredValue saves values to UserDefaults which has it's own layer of caching, but that caching is reserved for primitives such as Bool or String. Since a StoredValue is persisted as data every time they are accessed they have to be decoded using a JSONDecoder, which means every access of a value requires JSON decoding.

That is not very performant, so this pull request introduces an additional in-memory store of a StoredValue, similar to how Store has an in-memory layer to access and use values for the sake of performance. This same logic could be applied to SecurelyStoredValue but is intentionally eschewed to prevent keeping sensitive values in memory, defeating the purpose of SecurelyStoredValue using the system keychain as a backing store.

@mergesort mergesort merged commit 31e22ea into main Apr 12, 2024
1 check failed
@mergesort mergesort deleted the caching branch May 1, 2024 14:27
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.

2 participants