https://github.com/apinet/gcloud-redis
https://github.com/apinet/gcloud-redis
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/apinet/gcloud-redis
- Owner: apinet
- Created: 2021-11-26T21:43:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-08T15:09:19.000Z (over 1 year ago)
- Last Synced: 2025-02-27T02:24:24.239Z (over 1 year ago)
- Language: Go
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcloud-redis
Redis (gcloud) wrapper with mocking capabilities for golang cloud functions.
This package is based on redigo.
## usage
### initiate redis
```go
import (
redis "github.com/apinet/gcloud-redis"
)
maxIdle := 10
r := redis.NewRedis("ip:port", maxIdle)
```
### key operations
```go
r.SetString("key1", "a value")
r.Delete("key1", "key2")
```
### Pipeline operations
```go
pipe := r.Pipeline()
pipe.SetString("key1", "value")
incr := pipe.IncrBy("key2", 2)
if err := pipe.Exec() ; err != nil {
return err
}
// the incremented value after exec
incr.Value()
```