Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/severecloud/persistent-cache
An in-memory key:value persistent store/cache (similar to Memcached) library for Go, suitable for single-machine applications.
https://github.com/severecloud/persistent-cache
Last synced: about 2 months ago
JSON representation
An in-memory key:value persistent store/cache (similar to Memcached) library for Go, suitable for single-machine applications.
- Host: GitHub
- URL: https://github.com/severecloud/persistent-cache
- Owner: SevereCloud
- License: other
- Created: 2019-02-15T13:06:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-10T20:29:53.000Z (almost 6 years ago)
- Last Synced: 2024-10-07T13:41:06.641Z (3 months ago)
- Language: Go
- Size: 126 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# persistent-cache
[![Build Status](https://travis-ci.org/SevereCloud/persistent-cache.svg?branch=master)](https://travis-ci.org/SevereCloud/persistent-cache)
[![Go Report Card](https://goreportcard.com/badge/github.com/severecloud/persistent-cache)](https://goreportcard.com/report/github.com/severecloud/persistent-cache)
[![Documentation](https://godoc.org/github.com/severecloud/persistent-cache?status.svg)](http://godoc.org/github.com/severecloud/persistent-cache)
[![codecov](https://codecov.io/gh/SevereCloud/persistent-cache/branch/master/graph/badge.svg)](https://codecov.io/gh/SevereCloud/persistent-cache)
[![GitHub issues](https://img.shields.io/github/issues/severecloud/persistent-cache.svg)](https://github.com/severecloud/persistent-cache/issues)
[![license](https://img.shields.io/github/license/severecloud/persistent-cache.svg?maxAge=2592000)](https://github.com/severecloud/persistent-cache/LICENSE)[go-cache](https://github.com/patrickmn/go-cache) is an in-memory key:value
store/cache similar to memcached that issuitable for applications running on
a single machine. Its major advantage is that, being essentially a thread-safe
`map[string]interface{}` with expiration times, it doesn't need to serialize
or transmit its contents over the network.Any object can be stored, for a given duration or forever, and the cache can be
safely used by multiple goroutines.[persistent-cache](https://github.com/severecloud/persistent-cache) write cache
changes to the binlog file.## Installation
`go get github.com/severecloud/persistent-cache`
## Usage
```go
package mainimport (
"fmt"pcache "github.com/severecloud/persistent-cache"
)func main() {
c, err := pcache.Load(pcache.NoExpiration, 0, "test")
if err != nil {
c, err = pcache.New(pcache.NoExpiration, 0, "test")
if err != nil {
panic(err)
}
}foo, found := c.Get("foo")
if found {
fmt.Println(foo)
}c.SetDefault("foo", "bar")
}
```