Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y-yagi/cacher
https://github.com/y-yagi/cacher
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/y-yagi/cacher
- Owner: y-yagi
- License: mit
- Created: 2019-08-18T00:45:08.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-09T22:58:30.000Z (about 5 years ago)
- Last Synced: 2024-04-09T21:48:09.387Z (7 months ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cacher
[![GoDoc](https://godoc.org/github.com/y-yagi/cacher?status.svg)](https://godoc.org/github.com/y-yagi/cacher)
[![Go Report Card](https://goreportcard.com/badge/github.com/y-yagi/cacher)](https://goreportcard.com/report/github.com/y-yagi/cacher)
[![Build Status](https://circleci.com/gh/y-yagi/cacher.svg?style=svg)](https://circleci.com/gh/y-yagi/cacher)Cacher is a simple cache library. Provides cache system using file store by default.
Example:
```go
package cacher_testimport (
"fmt""github.com/y-yagi/cacher"
)func ExampleFileStore_Read() {
c := cacher.WithFileStore("/tmp/")
c.Write("cache-key", []byte("value"), cacher.Forever)value, _ := c.Read("cache-key")
fmt.Print(string(value))
// Output: value
}func ExampleFileStore_Delete() {
c := cacher.WithFileStore("/tmp/")
c.Write("cache-key", []byte("value"), cacher.Forever)c.Delete("cache-key")
value, _ := c.Read("cache-key")
fmt.Print(string(value))
// Output:
}
```## Other stores
* Redis Store: [y-yagi/cacherredis](https://github.com/y-yagi/cacherredis)