8000 GitHub - codecat/go-rollingcache: Simple rolling cache module for Go.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

codecat/go-rollingcache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rolling cache

This is a simple "rolling cache" module for Go. It works as a continuous request loop, where the data is only updated in a specific interval.

Example usage

On-demand request API:

// Start a cache loop with:
// - An interval of 30 seconds
// - An inactivity lifetime of 5 minutes (interval multiplied by 10)
// And return the byte data into `res`.
res, err := rollingcache.Get("https://httpbin.org/get", 30 * time.Second)

Continuous request API:

// Start a cache loop with some options. The returned object is a rollingcache.Cache pointer.
// You can use this pointer to get the cache data.
cache := rollingcache.Start("https://httpbin.org/get", rollingcache.Options{
	Interval: 10 * time.Second,
})

About

Simple rolling cache module for Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0