def setUp(self):
     global rts
     rts = RedisTimeSeries(port=port)
     rts.flushdb()
示例#2
0
# An example Python client for Redis key-value store using RedisTimeSeries.
from redistimeseries.client import Client as RedisTimeSeries
import time
import sys
import site
import datetime
import random

print(' \n '.join(sys.path))

ts = RedisTimeSeries(host='localhost', port=6379)

ts.flushdb()

key = 'temperature'


def create(key):

    print('\n Create new time series: %s' % str(key))

    #ts.create(key,retentionSecs=30,labels={'sensor_id' : 2,'area_id' : 32})
    ts.create(key,
              retention_msecs=30000,
              labels={
                  'sensor_id': 2,
                  'area_id': 32
              })

    print('')