Member-only story

Using Redis in Golang — Learning Golang

Izzat Arramsyah
2 min readSep 26, 2020

--

image from google.com

INTRODUCTION

Before we begin, let’s first understand what Redis is. In short, Redis is an open-source tool used as a database, cache, or message broker.

In this tutorial, we will use simple Redis operations, namely SET and GET, for data storage.

PREREQUISITE

To run Redis in our local environment, make sure we have installed Redis. If not, we can download it here. Once installed and running, we can use the following command to check if Redis is ready.

Use the following command to import the go-redis package.

go get github.com/go-redis/redis

FOLDER STRUCTURE

-ProjectGO
--pkg
--src
--cache
--CacheProcess.go
--interfaces
--Cache.go
--models
--Employee.go
--util
--RedisConn.go
--main.go

SETUP REDIS CONNECTION

First, we will create code to connect to our local Redis.

CACHE INTERACTOR

--

--

No responses yet