本文整理汇总了Python中couchbase._libcouchbase.Connection.set_multi方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.set_multi方法的具体用法?Python Connection.set_multi怎么用?Python Connection.set_multi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase._libcouchbase.Connection
的用法示例。
在下文中一共展示了Connection.set_multi方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_multi
# 需要导入模块: from couchbase._libcouchbase import Connection [as 别名]
# 或者: from couchbase._libcouchbase.Connection import set_multi [as 别名]
def set_multi(self, keys, ttl=0, format=None):
"""Set multiple keys
This follows the same semantics as
:meth:`~couchbase.libcouchbase.Connection.set`
:param dict keys: A dictionary of keys to set. The keys are the keys
as they should be on the server, and the values are the values for
the keys to be stored
:param int ttl: If specified, sets the expiration value for all
keys
:param int format:
If specified, this is the conversion format which will be used for
_all_ the keys.
:return: A :class:`~couchbase.libcouchbase.MultiResult` object, which
is a `dict` subclass.
The multi methods are more than just a convenience, they also save on
network performance by batch-scheduling operations, reducing latencies.
This is especially noticeable on smaller value sizes.
.. seealso::
:meth:`set`
"""
return _Base.set_multi(self, keys, ttl=ttl, format=format)
示例2: set_multi
# 需要导入模块: from couchbase._libcouchbase import Connection [as 别名]
# 或者: from couchbase._libcouchbase.Connection import set_multi [as 别名]
def set_multi(self, keys, ttl=0, format=None, persist_to=0, replicate_to=0):
"""Set multiple keys
This follows the same semantics as
:meth:`~couchbase.connection.Connection.set`
:param dict keys: A dictionary of keys to set. The keys are the keys
as they should be on the server, and the values are the values for
the keys to be stored.
From version 1.1.0, `keys` may also be a
:class:`~couchbase.items.ItemCollection`. If using a dictionary
variant for item collections, an additional `ignore_cas` parameter
may be supplied with a boolean value. If not specified, the operation
will fail if the CAS value on the server does not match the one
specified in the `Item`'s `cas` field.
:param int ttl: If specified, sets the expiration value for all
keys
:param int format:
If specified, this is the conversion format which will be used for
_all_ the keys.
:param int persist_to: Durability constraint for persistence.
Note that it is more efficient to use :meth:`endure_multi`
on the returned :class:`~couchbase.result.MultiResult` than
using these parameters for a high volume of keys. Using these
parameters however does save on latency as the constraint checking
for each item is performed as soon as it is successfully stored.
:param int replicate_to: Durability constraints for replication.
See notes on the `persist_to` parameter for usage.
:return: A :class:`~couchbase.result.MultiResult` object, which
is a `dict` subclass.
The multi methods are more than just a convenience, they also save on
network performance by batch-scheduling operations, reducing latencies.
This is especially noticeable on smaller value sizes.
.. seealso:: :meth:`set`
"""
return _Base.set_multi(self, keys, ttl=ttl, format=format,
persist_to=persist_to, replicate_to=replicate_to)