本文整理汇总了Python中couchbase._libcouchbase.Connection.add方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.add方法的具体用法?Python Connection.add怎么用?Python Connection.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase._libcouchbase.Connection
的用法示例。
在下文中一共展示了Connection.add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: from couchbase._libcouchbase import Connection [as 别名]
# 或者: from couchbase._libcouchbase.Connection import add [as 别名]
def add(self, key, value, ttl=0, format=None):
"""
Store an object in Couchbase unless it already exists.
Follows the same conventions as
:meth:`~couchbase.connection.Connection.set` but the value is
stored only if it does not exist already. Conversely, the value
is not stored if the key already exists.
Notably missing from this method is the `cas` parameter, this is
because `add` will only succeed if a key does not already exist
on the server (and thus can have no CAS)
:raise: :exc:`couchbase.exceptions.KeyExistsError` if the key
already exists
.. seealso:: :meth:`set`, :meth:`add_multi`
"""
return _Base.add(self, key, value, ttl=ttl, format=format)