Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/notiku/lithium
Simple and efficient caching for Go.
https://github.com/notiku/lithium
cache caching go go-cache
Last synced: about 2 months ago
JSON representation
Simple and efficient caching for Go.
- Host: GitHub
- URL: https://github.com/notiku/lithium
- Owner: notiku
- License: mit
- Created: 2024-09-20T18:57:22.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-21T13:09:33.000Z (3 months ago)
- Last Synced: 2024-09-21T13:10:20.162Z (3 months ago)
- Topics: cache, caching, go, go-cache
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lithium 🔋
Lithium is a simple and efficient caching library for Go, supporting multiple caching strategies.
## Installation
To install Lithium, use `go get`:
```sh
go get github.com/notiku/lithium
```## Usage
To create a new cache, use the `New` function and specify the caching strategy and any required parameters. The following example creates a new LRU cache with a maximum capacity of 100 items:
```go
package mainimport (
"fmt"
"github.com/notiku/lithium"
"github.com/notiku/lithium/rules"
)func main() {
c := lithium.New(rules.LRU, 100)
c.Set("key1", "value1")
value, found := c.Get("key1")
if found {
fmt.Println("Found:", value)
} else {
fmt.Println("Not found")
}
}
```## Available Caching Strategies
- Least Recently Used (LRU)
- More soon...## Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any problems.
## License
Lithium is licensed under the MIT license. See the [LICENSE](https://github.com/notiku/lithium/tree/master/LICENSE) file for more information.