def insert(self, key, value, *options, **kwargs):
        # type: (...)->ResultPrecursor
        """Store an object in Couchbase unless it already exists.

        Follows the same conventions as :meth:`upsert` 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 `insert` will only succeed if a key does not already
        exist on the server (and thus can have no CAS)

        :raise: :exc:`.KeyExistsError` if the key already exists

        .. seealso:: :meth:`upsert`
        """

        final_options = forward_args(kwargs, *options)
        return ResultPrecursor(_Base.insert(self.bucket, key, value, **final_options), final_options)
Пример #2
0
 def insert(self, key, value, *args, **kwargs):
     return _Base.insert(self, key, value, *args, **kwargs)