Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vtopc/wcache
In-memory cache with write-back strategy. DO NOT USE, it's very slow.
https://github.com/vtopc/wcache
cache cache-storage custom-callback expiration expiration-callback go golang graceful-shutdown in-memory-caching in-memory-storage lazy-writers pubsub trigger ttl write-back write-behind
Last synced: 3 days ago
JSON representation
In-memory cache with write-back strategy. DO NOT USE, it's very slow.
- Host: GitHub
- URL: https://github.com/vtopc/wcache
- Owner: vtopc
- License: mit
- Created: 2019-12-27T20:10:59.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-19T13:12:34.000Z (about 3 years ago)
- Last Synced: 2024-06-20T05:36:48.080Z (6 months ago)
- Topics: cache, cache-storage, custom-callback, expiration, expiration-callback, go, golang, graceful-shutdown, in-memory-caching, in-memory-storage, lazy-writers, pubsub, trigger, ttl, write-back, write-behind
- Language: Go
- Homepage: https://godoc.org/github.com/vtopc/wcache
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wcache
[![License][lic-img]][lic-url]
[![Godoc Reference][godoc-img]][godoc-url]Implements in-memory [cache with write-back strategy](https://en.wikipedia.org/wiki/Cache_(computing)#Writing_policies)
(a cache with expiration).
An expiration callback(`expireFn`) will be called when record is expired.### Features
* Thread-safe.
* Per-key or global TTL.
* Can trigger a custom callback on key expiration(could be used as Pub/Sub with aggregation).
* Can trigger a custom callback on key collisions(e.g. for aggregating metrics).
By default, will overwrite value.
* Graceful shutdown(using context). Will call expiration callback for all records,
ignoring they TTL.### Install
`go get github.com/vtopc/wcache`### TODO
* Optional auto-extending expiration on `Get` and/or `Set`.[godoc-url]: https://godoc.org/github.com/vtopc/wcache
[godoc-img]: https://godoc.org/github.com/vtopc/wcache?status.svg[lic-url]: https://github.com/vtopc/wcache/blob/master/LICENSE
[lic-img]: http://img.shields.io/badge/license-MIT-red.svg?style=flat### Similar projects
* https://github.com/mailgun/holster#expirecache