本文整理汇总了Python中couchbase._libcouchbase.Connection.append方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.append方法的具体用法?Python Connection.append怎么用?Python Connection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase._libcouchbase.Connection
的用法示例。
在下文中一共展示了Connection.append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: append
# 需要导入模块: from couchbase._libcouchbase import Connection [as 别名]
# 或者: from couchbase._libcouchbase.Connection import append [as 别名]
def append(self, key, value, cas=0, ttl=0, format=None):
"""
Append a string to an existing value in Couchbase.
This follows the same conventions as
:meth:`~couchbase.libcouchbase.Connection.set`.
The `format` argument must be one of :const:`~couchbase.FMT_UTF8` or
:const:`~couchbase.FMT_BYTES`. If not specified, it will be
:const:`~couchbase.FMT_UTF8`
(overriding the :attr:`default_format` attribute).
This is because JSON or Pickle formats will be nonsensical when
random data is appended to them. If you wish to modify a JSON or
Pickle encoded object, you will need to retrieve it (via :meth:`get`),
modify it, and then store it again (using :meth:`set`).
Additionally, you must ensure the value (and flags) for the current
value is compatible with the data to be appended. For an example,
you may append a :const:`~couchbase.FMT_BYTES` value to an existing
:const:`~couchbase.FMT_JSON` value, but an error will be thrown when
retrieving the value using
:meth:`get` (you may still use the :attr:`data_passthrough` to
overcome this).
:raise: :exc:`couchbase.exceptions.NotStoredError` if the key does
not exist
.. seealso::
:meth:`set`
:meth:`append_multi`
"""
return _Base.append(self, key, value, ttl=ttl, cas=cas, format=format)