class CacheTest(unittest.TestCase): """ redis 2.88.11 """ def setUp(self): self.cc = ShardCache(servers) self.keys = [str(time.time()) for i in range(1000)] def tearDown(self): for k in self.keys: self.cc.delete(k) def test_shard_cache(self): for k in self.keys: self.cc.set(k, k) for k in self.keys: name, host, port, db = tuple(self.cc.shard_client.get_server(k).split(':')) conn = self.cc.shard_client.connect_redis(host, int(port), int(db)) self.assertEqual(pickle.loads(conn.get(k)), k)
def setUp(self): self.cc = ShardCache(servers) self.keys = [str(time.time()) for i in range(1000)]