https://github.com/acim/cog
Thread safe generic cache implementations in Go
https://github.com/acim/cog
Last synced: 12 months ago
JSON representation
Thread safe generic cache implementations in Go
- Host: GitHub
- URL: https://github.com/acim/cog
- Owner: acim
- License: apache-2.0
- Created: 2022-11-23T07:04:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-04T16:27:32.000Z (almost 3 years ago)
- Last Synced: 2025-04-02T00:23:02.760Z (about 1 year ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# cog
[](https://github.com/acim/cog/actions/workflows/pipeline.yaml)
[](https://pkg.go.dev/go.acim.net/cog)
[](https://goreportcard.com/report/go.acim.net/cog)

Thread safe generic cache implementations in Go, fully tested and optimized for best performance.
## [LRU Cache]() Example
```go
package main
import (
"fmt"
"go.acim.net/cog/lru"
)
func main() {
cache := lru.NewCache[string, string](10)
cache.Set("foo", "bar")
v, ok := cache.Get("foo")
if !ok {
panic("want value")
}
fmt.Printf("foo = %s\n", v)
}
```
## License
Licensed under either of
- Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.