
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
github.com/no-src/nscache
go get -u github.com/no-src/nscache
First, you need to import the cache driver, then create your cache component instance with the specified connection string and use it.
Current support following cache drivers
Driver | Import Driver Package | Connection String Example |
---|---|---|
Memory | github.com/no-src/nscache/memory | memory: |
Redis | github.com/no-src/nscache/redis | redis://127.0.0.1:6379 |
BuntDB | github.com/no-src/nscache/buntdb | buntdb://:memory: or buntdb://buntdb.db |
Etcd | github.com/no-src/nscache/etcd | etcd://127.0.0.1:2379?dial_timeout=5s |
BoltDB | github.com/no-src/nscache/boltdb | boltdb://boltdb.db |
For example, initial a memory cache and write, read and remove data.
package main
import (
"time"
_ "github.com/no-src/nscache/memory"
"github.com/no-src/log"
"github.com/no-src/nscache"
)
func main() {
// initial cache driver
c, err := nscache.NewCache("memory:")
if err != nil {
log.Error(err, "init cache error")
return
}
defer c.Close()
// write data
k := "hello"
c.Set(k, "world", time.Minute)
// read data
var v string
if err = c.Get(k, &v); err != nil {
log.Error(err, "get cache error")
return
}
log.Info("key=%s value=%s", k, v)
// remove data
if err = c.Remove(k); err != nil {
log.Error(err, "remove cache error")
return
}
}
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.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.
Security News
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.