本文整理汇总了Python中couchbase.bucket.Bucket.remove_multi方法的典型用法代码示例。如果您正苦于以下问题:Python Bucket.remove_multi方法的具体用法?Python Bucket.remove_multi怎么用?Python Bucket.remove_multi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase.bucket.Bucket
的用法示例。
在下文中一共展示了Bucket.remove_multi方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SDKClient
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import remove_multi [as 别名]
#.........这里部分代码省略.........
persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
raise
def replace_multi(self, keys, cas=0, ttl=0, format=None, persist_to=0, replicate_to=0):
try:
self.cb.replace_multi( keys, cas=cas, ttl=ttl, format=format, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
try:
time.sleep(10)
self.cb.replace_multi( keys, cas=cas, ttl=ttl, format=format, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
raise
def cas(self, key, value, cas=0, ttl=0, format=None):
return self.cb.replace(key, value, cas=cas,format=format)
def delete(self,key, cas=0, quiet=True, persist_to=0, replicate_to=0):
self.remove(key, cas=cas, quiet=quiet, persist_to=persist_to, replicate_to=replicate_to)
def remove(self,key, cas=0, quiet=True, persist_to=0, replicate_to=0):
try:
return self.cb.remove(key, cas=cas, quiet=quiet, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
try:
time.sleep(10)
return self.cb.remove(key, cas=cas, quiet=quiet, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
raise
def delete(self, keys, quiet=True, persist_to=0, replicate_to=0):
return self.remove(self, keys, quiet=quiet, persist_to=persist_to, replicate_to=replicate_to)
def remove_multi(self, keys, quiet=True, persist_to=0, replicate_to=0):
try:
self.cb.remove_multi(keys, quiet=quiet, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
try:
time.sleep(10)
self.cb.remove_multi(keys, quiet=quiet, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
raise
def set(self, key, value, cas=0, ttl=0, format=None, persist_to=0, replicate_to=0):
return self.upsert(key, value, cas=cas, ttl=ttl, format=format, persist_to=persist_to, replicate_to=replicate_to)
def upsert(self, key, value, cas=0, ttl=0, format=None, persist_to=0, replicate_to=0):
try:
self.cb.upsert(key, value, cas, ttl, format, persist_to, replicate_to)
except CouchbaseError as e:
try:
time.sleep(10)
self.cb.upsert(key, value, cas, ttl, format, persist_to, replicate_to)
except CouchbaseError as e:
raise
def set_multi(self, keys, ttl=0, format=None, persist_to=0, replicate_to=0):
return self.upsert_multi(keys, ttl=ttl, format=format, persist_to=persist_to, replicate_to=replicate_to)
def upsert_multi(self, keys, ttl=0, format=None, persist_to=0, replicate_to=0):
try:
self.cb.upsert_multi(keys, ttl=ttl, format=format, persist_to=persist_to, replicate_to=replicate_to)
except CouchbaseError as e:
try:
time.sleep(10)
self.cb.upsert_multi(keys, ttl=ttl, format=format, persist_to=persist_to, replicate_to=replicate_to)
示例2: CouchbaseMemcacheMirror
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import remove_multi [as 别名]
#.........这里部分代码省略.........
try:
rv = self.cb.get(key)
return key, rv.cas
except NotFoundError:
return None, None
else:
return self.mc.gets(key)
def gets_multi(self, keys):
if self._primary == PRIMARY_COUCHBASE:
try:
rvs = self.cb.get_multi(keys)
except NotFoundError as e:
rvs, _ = e.split_results()
return {k: (v.value, v.cas) for k, v in rvs}
else:
# TODO: I'm not sure if this is implemented in HasClient :(
return self.mc.gets_many(keys)
def delete(self, key):
st = Status()
try:
self.cb.remove(key)
except NotFoundError as e:
st.cb_error = e
st.mc_status = self.mc.delete(key)
return st
def delete_multi(self, keys):
st = Status()
try:
self.cb.remove_multi(keys)
except NotFoundError as e:
st.cb_error = e
st.mc_status = self.mc.delete_many(keys)
def _do_incrdecr(self, key, value, is_incr):
cb_value = value if is_incr else -value
mc_meth = self.mc.incr if is_incr else self.mc.decr
st = Status()
try:
self.cb.counter(key, delta=cb_value)
except NotFoundError as e:
st.cb_error = e
st.mc_status = mc_meth(key, value)
def incr(self, key, value):
return self._do_incrdecr(key, value, True)
def decr(self, key, value):
return self._do_incrdecr(key, value, False)
def touch(self, key, expire=0):
st = Status()
try:
self.cb.touch(key, ttl=expire)
except NotFoundError as e:
st.cb_error = st
st.mc_status = self.mc.touch(key)
def set(self, key, value, expire=0):
开发者ID:couchbaselabs,项目名称:sk-python-couchbase-memcache-mirror,代码行数:70,代码来源:couchbase_memcache_mirror.py
示例3: in
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import remove_multi [as 别名]
for x in ("joe", "jim", "bill", "larry")])
# Save them all
cb.upsert_multi(players)
# Give them all some points
for p, options in players:
p.score += randint(20, 2000)
# also set the email?
if not p.email:
p.email = "{0}@{0}.notspecified.com".format(p.name)
cb.replace_multi(players)
all_players = ItemSequence([x[0] for x in players] + [single_player])
INDENT = " " * 3
for player in all_players.sequence:
print "Name:", player.name
print INDENT , player
lines = []
lines.append("email: {0}".format(player.email))
lines.append("score: {0}".format(player.score))
for line in lines:
print INDENT, line
cb.remove_multi(all_players)
cb.endure_multi(all_players, check_removed=True, replicate_to=0,
persist_to=1)
示例4: ReverseTranscoder
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import remove_multi [as 别名]
from couchbase.bucket import Bucket
class ReverseTranscoder(Transcoder):
def encode_key(self, key):
return super(ReverseTranscoder, self).encode_key(key[::-1])
def decode_key(self, key):
key = super(ReverseTranscoder, self).decode_key(key)
return key[::-1]
c_reversed = Bucket('couchbase://localhost/default',
transcoder=ReverseTranscoder())
c_plain = Bucket('couchbase://localhost/default')
c_plain.remove_multi(('ABC', 'CBA', 'XYZ', 'ZYX'), quiet=True)
c_reversed.upsert("ABC", "This is a reversed key")
rv = c_plain.get("CBA")
print("Got value for reversed key '{0}'".format(rv.value))
rv = c_reversed.get("ABC")
print("Got value for reversed key '{0}' again".format(rv.value))
c_plain.upsert("ZYX", "This is really ZYX")
rv = c_reversed.get("XYZ")
print("Got value for '{0}': '{1}'".format(rv.key, rv.value))