本文整理汇总了Python中umemcache.Client.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Client.connect方法的具体用法?Python Client.connect怎么用?Python Client.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umemcache.Client
的用法示例。
在下文中一共展示了Client.connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTupleRefCrashFix
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testTupleRefCrashFix(self):
client = Client(MEMCACHED_ADDRESS)
for i in range(1000):
try:
client.connect()
except:
pass
示例2: testVersion
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testVersion(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
v = c.version()
l = v.split('.');
self.assertEquals(3, len(l))
示例3: testFlushAll
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testFlushAll(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.set("key1", "31337")
self.assertEquals(c.get("key1")[0], "31337")
c.flush_all()
self.assertEquals(c.get("key1"), None)
示例4: testStats
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testStats(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
d = c.stats()
self.assertTrue (d.has_key("uptime"))
self.assertTrue (d.has_key("bytes"))
示例5: testAppend
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testAppend(self):
c = Client(MEMCACHED_ADDRESS)
c.connect()
c.set("key1", "a")
self.assertEquals("STORED", c.append("key1", "b"))
self.assertEquals("ab", c.get("key1")[0])
pass
示例6: testDel
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testDel(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.set("key1", "a")
c.delete("key1")
self.assertEquals(None, c.get("key1"))
pass
示例7: testGet
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testGet(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.set("key", "value")
self.assertEquals("value", c.get("key")[0])
self.assertEquals(None, c.get("key23123"))
pass
示例8: testPrepend
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testPrepend(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.set("key1", "a")
self.assertEquals("STORED", c.prepend("key1", "b"))
self.assertEquals("ba", c.get("key1")[0])
pass
示例9: testReplace
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testReplace(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.set("key1", "value1")
self.assertEquals("STORED", c.replace("key1", "value"))
pass
pass
示例10: testBigDataFail
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testBigDataFail(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
data = "31337" * 10000
for x in xrange(0, 10):
v = c.get("kaka" + str(x))
c.set("fsdafbdsakjfjdkfjadklsafdsafdsaffdsafdasfdsafdasfsdafdsafdsafasdas" + str(x), data, 604830, 17, True)
示例11: testCas
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testCas(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.set("key1", "a")
value, flags, cas = c.gets("key1")
self.assertEquals("STORED", c.cas("key1", "b", cas))
c.set("key1", "a")
self.assertEquals("EXISTS", c.cas("key1", "b", cas))
示例12: testOversizedKey
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testOversizedKey(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
data = "A" * (1000 * 1000 * 2)
try:
r = c.set("test", data)
assert False
except(RuntimeError):
pass
示例13: testConnectCloseQuery
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testConnectCloseQuery(self):
c = Client(MEMCACHED_ADDRESS);
c.connect();
c.disconnect();
try:
r = c.set("jonas", "kaka", 0, False)
assert False
except:
pass
示例14: testSockAccess
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testSockAccess(self):
# accessing the members before connect() is called
c = Client(MEMCACHED_ADDRESS)
self.assertEquals(c.host, MEMCACHED_HOST)
self.assertEquals(c.port, MEMCACHED_PORT)
self.assertTrue(isinstance(c.sock, socket.socket))
c.sock.settimeout(2)
c.connect()
c.set("key1", "31337")
self.assertEquals(c.get("key1")[0], "31337")
示例15: testConnectFails
# 需要导入模块: from umemcache import Client [as 别名]
# 或者: from umemcache.Client import connect [as 别名]
def testConnectFails(self):
c = Client("130.244.1.1:31337");
try:
c.connect();
assert False
except:
pass
c.disconnect();
pass