Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahiho/xcache
https://github.com/ahiho/xcache
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ahiho/xcache
- Owner: ahiho
- Created: 2022-07-07T02:21:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-20T04:45:35.000Z (almost 2 years ago)
- Last Synced: 2024-11-24T00:59:44.514Z (3 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# XCache - Just a simple cache wrapper
Inspired from `IDistributedCache` of `Asp.net`
Caching is very general things backend usage. In development or small scale we can just use in-memory cache libraries such as `go-cache`, `ristretto`. But when application scale up and need run in multiple replicas, it's neccessary to using centralize cache such as `Redis` or `Memcached`. But ofc no one wanna refactor all of cache usage code with new libraries.
We made this as a simple interfaces function for `xcache` and can use `redis` or `ristretto` as a backed end for store data. When change from `ristretto` to `redis` we only need change code for create driver.
You can also develop your own driver which just need implement below functions
```
type Driver interface {
Set(k string, v string, d time.Duration) error
Get(k string) (*string, error)
Del(k string) error
MultiSet(m map[string]string, d time.Duration) error
MultiGet(k []string) (map[string]string, error)
MultiDel(k []string) error
}
```