# README
xredis
Handy wrapper around github.com/redis/go-redis/v9
package. All the Redis client methods are usable on the xredis client.
Usage
-
Script
const lua = `local age=redis.call("get", KEYS[1]) local result="Hello "..ARGV[1].." "..KEYS[1]..", you are "..age.." years old!" return result` func main() { ctx := context.Background() xclient := xredis.New(redisClient) script := xredis.NewScript(lua) err := xclient.Set(ctx, "Abitbol", 42, time.Hour).Err() if err != nil { panic(err) } value, err := xclient.Run(ctx, script, []string{"Abitbol"}, "George") if err != nil { panic(err) } fmt.Println(value.String()) // => Hello George Abitbol, you are 42 years old! }
-
Value object is a JSON value?
json.Unmarshal(value.Bytes(), &object)
License
MIT
Contributing
All PRs are welcome.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
# Variables
ErrNotASlice is used when a value is not castable into a slice.
# Type aliases
A Client defines all client Redis actions (Client or ClusterClient).