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.
StoredValue
saves values to UserDefaults which has it's own layer of caching, but that caching is reserved for primitives such asBool
orString
. Since aStoredValue
is persisted as data every time they are accessed they have to be decoded using aJSONDecoder
, 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 howStore
has an in-memory layer to access and use values for the sake of performance. This same logic could be applied toSecurelyStoredValue
but is intentionally eschewed to prevent keeping sensitive values in memory, defeating the purpose ofSecurelyStoredValue
using the system keychain as a backing store.