(key string)
| 48 | } |
| 49 | |
| 50 | func (store *KeyValueStore) Get(key string) (string, error) { |
| 51 | store.RLock() |
| 52 | value, ok := store.m[key] |
| 53 | store.RUnlock() |
| 54 | |
| 55 | if !ok { |
| 56 | return "", ErrorNoSuchKey |
| 57 | } |
| 58 | |
| 59 | return value, nil |
| 60 | } |
| 61 | |
| 62 | func (store *KeyValueStore) Put(key string, value string) error { |
| 63 | store.Lock() |