Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
github.com/onskycloud/go-redis
Redis client for golang
Get by key
func (r *Redis) Get(key string) (string, error) {
return r.db.Get(key).Result()
}
Get by key and field
func (r *Redis) GetObject(objectKey string, field string, result interface{}) error {
temp, err := r.db.HGet(objectKey, field).Bytes()
if err != nil {
return err
}
err = msgpack.Unmarshal(temp, result)
return err
}
Set by key
func (r *Redis) Set(key string, value interface{}, expiration time.Duration) (string, error) {
return r.db.Set(key, value, expiration).Result()
}
Set by key and field
func (r *Redis) SetObject(objectKey string, field string, value interface{}) (bool, error) {
bytes, err := msgpack.Marshal(value)
if err != nil {
return false, err
}
return r.db.HSet(objectKey, field, bytes).Result()
}
Check exist by key and field
// CheckExistedObject will return true if the object is existed.
func (r *Redis) CheckExistedObject(objectKey string, field string) (bool, error) {
existed, err := r.db.HExists(objectKey, field).Result()
if err != nil {
return false, err
}
if existed == true {
return true, nil
}
return false, nil
}
Request handler requires Go v1.13+ to run.
Install the package.
$ go get -u github.com/onskycloud/go-redis
See KUBERNETES.md
MIT
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.