In this section, you will learn how to develop an unsophisticated version of a key-value store in Go, which means that you will learn how to implement the core functionality of a key-value store without any additional bells and whistles. The idea behind a key-value store is modest: answer queries fast and, generally speaking, work as fast as possible. This translates into using simple algorithms and simple data structures.
The program presented now will basically implement the four fundamental tasks of a key-value store:
- Adding a new element
- Deleting an existing element from the key-value store based on a key
- Looking up for the value of a specific key in the store, and
- Changing the value of an existing key
These four functions allow you to have full control over the key-value store. The commands for these four functions will be named ADD
, DELETE
, LOOKUP
, and CHANGE
, respectively. This means that the program will only operate when its gets one of these four commands...