https://github.com/xuender/fttl
Time To Live Cache Based on File System
https://github.com/xuender/fttl
Last synced: 2 months ago
JSON representation
Time To Live Cache Based on File System
- Host: GitHub
- URL: https://github.com/xuender/fttl
- Owner: xuender
- License: mit
- Created: 2024-07-19T02:55:52.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-08-21T02:58:31.000Z (10 months ago)
- Last Synced: 2025-02-09T19:40:50.654Z (4 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# fttl
[![Action][action-svg]][action-url]
[![Report Card][goreport-svg]][goreport-url]
[![Lines of code][lines-svg]][lines-url]
[![godoc][godoc-svg]][godoc-url]
[![License][license-svg]][license-url]✨ **`xuender/fttl` is a time to live cache based on file system.**
## 🚀 Install
```shell
go install github.com/xuender/fttl@latest
```## 💡 Usage
### base
```go
fdb := fttl.New(filepath.Join(os.TempDir(), "base"))
defer fdb.Close()fdb.Put([]byte("key"), []byte("value"))
val, _ := fdb.Get([]byte("key"))
fmt.Println(string(val))
fmt.Println(fdb.Has([]byte("key")))fdb.Delete([]byte("key"))
```### ttl
```go
fdb.PutTTL([]byte("key"), []byte("value"), time.Minute, time.Second)
```## 👤 Contributors
![Contributors][contributors-svg]
## 📝 License
© ender, 2024~time.Now
[MIT LICENSE][license-url]
[action-url]: https://github.com/xuender/fttl/actions
[action-svg]: https://github.com/xuender/fttl/workflows/Go/badge.svg[goreport-url]: https://goreportcard.com/report/github.com/xuender/fttl
[goreport-svg]: https://goreportcard.com/badge/github.com/xuender/fttl[godoc-url]: https://godoc.org/github.com/xuender/fttl
[godoc-svg]: https://godoc.org/github.com/xuender/fttl?status.svg[license-url]: https://github.com/xuender/fttl/blob/master/LICENSE
[license-svg]: https://img.shields.io/badge/license-MIT-blue.svg[contributors-svg]: https://contrib.rocks/image?repo=xuender/fttl
[lines-svg]: https://sloc.xyz/github/xuender/fttl
[lines-url]: https://github.com/boyter/scc