forked from krishauser/reem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
19 lines (15 loc) · 689 Bytes
/
example.py
File metadata and controls
19 lines (15 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import print_function
from reem.connection import RedisInterface
from reem.datatypes import KeyValueStore
import numpy as np
interface = RedisInterface(host="localhost")
interface.initialize()
server = KeyValueStore(interface)
# Set a key and read it and its subkeys
server["foo"] = {"number": 100.0, "string": "REEM"}
print("Reading Root : {}".format(server["foo"].read()))
print("Reading Subkey: {}".format(server["foo"]["number"].read()))
# Set a new key that didn't exist before to a numpy array
server["foo"]["numpy"] = np.random.rand(3,4)
print("Reading Root : {}".format(server["foo"].read()))
print("Reading Subkey: {}".format(server["foo"]["numpy"].read()))