https://github.com/issue9/cache
通用的缓存接口
https://github.com/issue9/cache
cache memcached
Last synced: 4 months ago
JSON representation
通用的缓存接口
- Host: GitHub
- URL: https://github.com/issue9/cache
- Owner: issue9
- License: mit
- Created: 2017-02-26T12:28:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-12-04T04:40:51.000Z (6 months ago)
- Last Synced: 2025-12-07T10:52:36.463Z (6 months ago)
- Topics: cache, memcached
- Language: Go
- Homepage: https://pkg.go.dev/github.com/issue9/cache
- Size: 145 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cache
[](https://codecov.io/gh/issue9/cache)
[](https://pkg.go.dev/github.com/issue9/cache)


通用的缓存接口
目前支持以下组件:
名称 | 包 | 状态
-----------|--------------------------------------|-----
memory | 内存 | [](https://github.com/issue9/cache/actions?query=workflow%3Amemory)
memcached | | [](https://github.com/issue9/cache/actions?query=workflow%3Amemcached)
redis | | [](https://github.com/issue9/cache/actions?query=workflow%3Aredis)
```go
// memory
c, _ := memory.New(...)
c.Set("number", 1)
var v int
c.Get("number",&v)
print(v)
// memcached
c = memcache.New("localhost:11211")
c.Set("number", 1)
c.Get("number", &v)
print(v)
n, setN, exists, err := c.Counter("n")
setN(-1) // 为 n 减 1
setN(10) // 为 n 加上 10
```
## 安装
```shell
go get github.com/issue9/cache
```
## 版权
本项目采用 [MIT](https://opensource.org/licenses/MIT) 开源授权许可证,完整的授权说明可在 [LICENSE](LICENSE) 文件中找到。