Skip to content

A simple, fast and easy to use cache storage solution for caching of data on the same machine.

License

Notifications You must be signed in to change notification settings

mrbenosborne/go-cache

Repository files navigation

Go Cache

A simple, fast and easy to use cache storage solution for caching of data on the same machine. Cache is a small package that you can use in your Go application to store data for fast access.

Go

Go Reference

Install

go get github.com/mrbenosborne/go-cache

Example

package main

import (
	"fmt"

	"github.com/mrbenosborne/go-cache"
)

func main() {

	// Create a new cache with a default
	// size of 0.
	c := cache.New(0)

	// Create a new store for flights.
	s := c.New("flights")

	// Add an item to the store with the key: LGW
	// and the value of: "London Gatwick".
	s.Add("LGW", "London Gatwick")

	// Retrieve the item from the store.
	airportName := s.Get("LGW")
	fmt.Printf("The airport name is: %s\n", airportName)

	// Delete the item from the store.
	s.Delete("LGW")
}

About

A simple, fast and easy to use cache storage solution for caching of data on the same machine.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published