def write(self): """ Write a model to redis """ dio_r = DataIORedis() dio_r.connect() # Write the model to redis if self.is_valid(): return dio_r.write(key=self.genkey(), value=self.package()) else: log.error('Invalid model -> "{0}"'.format(str(self._model))) return False
def test_simple(self): dior = DataIORedis() dior.connect() # connect to local instance self.assertTrue(dior.write(key='try', value=1)) self.assertTrue(dior.read(key='try') == 1) del dior
def test_init(self): dior = DataIORedis() dior.connect() # connect to local instance del dior
def read(self, key): dio_r = DataIORedis() dio_r.connect() return dio_r.read(key=key)