How it works...
Working with Redis in Go is very similar to working with MySQL, although there's not a standard library, a lot of the same conventions are followed with functions such as Scan() to read data from Redis into Go types. It can be challenging to pick the best library to use in cases like this and I suggest surveying what's available periodically, as things can rapidly change.
This recipe uses a redis package to do basic setting and getting, doing a more complex sort function, and basic configuration. Like database/sql, you can set additional configuration in the form of write timeouts, poolsize, and more. Redis itself also provides a lot of additional functionality, including Redis cluster support, Zscore and counter objects, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access