Skip to content
Commit 74e4ac08 authored by Damian Krolik's avatar Damian Krolik Committed by Carles Cufí
Browse files

nvs: implement NVS cache



The NVS data lookup time grows linearly with the number of
allocation table entries to walk through, meaning that if
some data pair in the NVS changes frequently, access to
other data pairs that change rarely can take a lot of time.

It is particularly visible when the NVS is used as the
settings backend since the backend needs to perform multiple
NVS reads to find a requested key.

Implement a simple cache that stores an address of the most
recent ATE for all NVS IDs that fall into the given cache
position. CRC8/16 is used as a hash function used to
distribute NVS IDs across the cache entries.

The cache entries are only invalidated when an NVS sector
is erased as part of the garbage collector task.

Signed-off-by: default avatarDamian Krolik <damian.krolik@nordicsemi.no>
parent cb88f7dc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment