Skip to content

jason-shen/redis-client

Repository files navigation

redis client for go

redis client library is to make easy to do crud with json object in redis

Features

  • create json objects
  • update json objects
  • delete json object
  • add list
  • edit list
  • remove list items by key
  • delete list by key

Installing the Library

go get https://github.com/jason-shen/redis-client

Usage

example of Create/Update

func main()  {
redis := client.NewRedisCache("localhost:6379", "", 1, 1000)
key := "myfirst_key"
sample := map[string]interface{} {
"firstname": "hello1",
"lastname": "world0",
}

sample2 := map[string]interface{} {
"firstname": "hello2",
"lastname": "world1",
}
sample3 := map[string]interface{} {
"firstname": "hello3",
"lastname": "world2",
}

redis.Create(key, sample)
data, err := redis.Read(key)
if err != nil {
panic(err)
}
fmt.Println("object create", data)
redis.Update(key, sample2)
data2, err := redis.Read(key)
fmt.Println("object update 1", data2)
redis.Update(key, sample3)
data3, err := redis.Read(key)
fmt.Println("object update 2", data3)
}

result

image for the full code please see the example folder

Dependencies

License

MIT License - see LICENSE for full text

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages