41 lines
748 B
Markdown
41 lines
748 B
Markdown
# Go Redis Inventory
|
|
|
|
A Go library for managing inventory using Redis.
|
|
|
|
## Features
|
|
|
|
- Get and update inventory quantities
|
|
- Reserve inventory with atomic operations using Lua scripts
|
|
- Listen to inventory changes via Redis pub/sub
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
go get git.k6n.net/go-redis-inventory
|
|
```
|
|
|
|
## Usage
|
|
|
|
Import the package:
|
|
|
|
```go
|
|
import "git.k6n.net/go-redis-inventory/pkg/inventory"
|
|
```
|
|
|
|
Create a Redis client and initialize the service:
|
|
|
|
```go
|
|
client := redis.NewClient(&redis.Options{
|
|
Addr: "localhost:6379",
|
|
})
|
|
service, err := inventory.NewRedisInventoryService(client)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
```
|
|
|
|
## Dependencies
|
|
|
|
- Go 1.25.1 or later
|
|
- Redis server
|
|
- [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) |