25b3nk / learnCache

Learning about middleware and caching. Reference: https://dev.to/franciscomendes10866/easy-and-simple-in-memory-cache-in-golang-1lpb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

learnCache

Introduction

This git is to learn about caching and implementing a middleware that will check if the current request is cached, if so, we return cached data else we fetch data from JSONPlaceholder and return the data. The response has the key data, if fetched else cached when we get the data from the cache.

Run and test

$ go run main.go

The server runs at http://localhost:3000/. One can hit the endpoint http://localhost:3000/<id>, where id is an integer and verify the caching.

About

Learning about middleware and caching. Reference: https://dev.to/franciscomendes10866/easy-and-simple-in-memory-cache-in-golang-1lpb

License:The Unlicense


Languages

Language:Go 100.0%