Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A simple cache with TTL, this is just a "I just had an idea and spent like 5 minutes on it but I dont want to lose this development" kind of repository, nothing really serious

License

gustapinto/go-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-cache

A simple cache with ttl and background expiration process

Example Usage

package main

import (
	"fmt"
	"time"

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

func main() {
	st := cache.NewInMemoryStore()

	st.Set("FooKey", "FooValue", time.Now().Add(5*time.Second))

	value, exists := st.Get("FooKey")
	fmt.Printf("value=%s, exists=%v", value, exists)
}

About

A simple cache with TTL, this is just a "I just had an idea and spent like 5 minutes on it but I dont want to lose this development" kind of repository, nothing really serious

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages