O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Once we run the program, the HTTP server will start locally listening on port 8080.

On startup, the key with the name foo with a value as bar will be added to the cache. 

Browsing http://localhost:8080/ will read a key value from the cache and append it to Hello as shown in the following screenshot:

We have specified the cache data expiration time in our program as five minutes, which means the key that we have created in the cache at server startup will not be there after five minutes. So, accessing the same URL again after five minutes will return Key Not Found in the Cache from the server, as follows:

Let's understand the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required