https://github.com/deis/memkv
Simple in-memory key/value store backed by a map
https://github.com/deis/memkv
Last synced: 5 months ago
JSON representation
Simple in-memory key/value store backed by a map
- Host: GitHub
- URL: https://github.com/deis/memkv
- Owner: deis
- License: mit
- Fork: true (kelseyhightower/memkv)
- Created: 2015-04-28T17:15:27.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-01-29T17:31:01.000Z (over 10 years ago)
- Last Synced: 2024-06-19T04:17:18.150Z (about 2 years ago)
- Language: Go
- Size: 23.4 KB
- Stars: 1
- Watchers: 17
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# memkv
Simple in memory k/v store.
[](https://travis-ci.org/kelseyhightower/memkv) [](https://godoc.org/github.com/kelseyhightower/memkv)
## Usage
```Go
package main
import (
"fmt"
"log"
"github.com/kelseyhightower/memkv"
)
func main() {
s := memkv.New()
s.Set("/myapp/database/username", "admin")
s.Set("/myapp/database/password", "123456789")
s.Set("/myapp/port", "80")
kv, err := s.Get("/myapp/database/username")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Key: %s, Value: %s\n", kv.Key, kv.Value)
ks, err := s.GetAll("/myapp/*/*")
if err == nil {
for _, kv := range ks {
fmt.Printf("Key: %s, Value: %s\n", kv.Key, kv.Value)
}
}
}
```
---
```
Key: /myapp/database/username, Value: admin
Key: /myapp/database/password, Value: 123456789
Key: /myapp/database/username, Value: admin
```