Last active
May 17, 2022 09:30
-
-
Save erangaeb/db78d6758c80de70b7e5cc474ad3fa10 to your computer and use it in GitHub Desktop.
redis SADD with golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sadd(key string, val string) error { | |
// get conn and put back when exit from method | |
conn := pool.Get() | |
defer conn.Close() | |
_, err := conn.Do("SADD", key, val) | |
if err != nil { | |
log.Printf("ERROR: fail add val %s to set %s, error %s", val, key, err.Error()) | |
return err | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment