https://github.com/aldy505/cheapcash
Utilizing SSD as a cheap caching storage
https://github.com/aldy505/cheapcash
Last synced: about 2 months ago
JSON representation
Utilizing SSD as a cheap caching storage
- Host: GitHub
- URL: https://github.com/aldy505/cheapcash
- Owner: aldy505
- License: mit
- Created: 2021-11-16T04:56:47.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-19T15:31:53.000Z (over 3 years ago)
- Last Synced: 2025-02-07T10:50:31.597Z (3 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cheapcash
[](https://pkg.go.dev/github.com/aldy505/cheapcash) [](https://goreportcard.com/report/github.com/aldy505/cheapcash)  [](https://www.codefactor.io/repository/github/aldy505/cheapcash) [](https://codecov.io/gh/aldy505/cheapcash) [](https://www.codacy.com/gh/aldy505/cheapcash/dashboard?utm_source=github.com&utm_medium=referral&utm_content=aldy505/cheapcash&utm_campaign=Badge_Grade) [](https://github.com/aldy505/cheapcash/actions/workflows/ci.yml)
SSD is cheap. Why don't we use it for caching?
A simple library implementing filesystem I/O as a cache. Should be must useful when used again a Solid State Drive
for maximum speed and to handle good amount of concurrent read/write.The API itself is also pretty simple considering I don't want this to be a full-blown caching library like Redis,
I just want it to be simple like Bigcache or similar caching library.## Install
```go
import "github.com/aldy505/cheapcash"
```## Usage
It has simple API for reading & storing cache.
```go
package mainimport (
"log""github.com/aldy505/cheapcash"
)func main() {
// Create a Cheapcash instance.
// Of course you can make multiple instance for multiple
// root directories.
cache := cheapcash.New("/tmp/cheapcash")
// or if you are feeling lazy
cache = cheapcash.Default()
// path defaults to /tmp/cheapcasherr := cache.Write("users:list", usersList)
if err != nil {
log.Fatal(err)
}val, err := cache.Read("users:list")
if err != nil {
log.Fatal(err)
}log.Println(string(val))
err = cache.Append("users:list", []byte("\nMarcel"))
if err != nil {
log.Fatal(err)
}err = cache.Delete("users:list")
if err != nil {
log.Fatal(err)
}
}
```See Godoc documentation (link above, beneath the title) for more complete documentation of the package.
## License
[MIT](./LICENSE)