Junior — Senior
Local cache for remote KV store
livecode
Task condition
It is necessary to implement a local cache that will covertly wrap the operation with a remote key-value database (key — user identifier, value — their IPv4 address). The goal is to reduce access time (approximately 100 ms) by locally storing frequently requested data. User code interacts with the database through the previous interface, unaware of the cache; all caching logic should be encapsulated within the implementation.
type KVDatabase interface {
Get(key string) (string, error)
Keys() ([]string, error)
MGet(keys []string) ([]*string, error)
}