Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: Python 1.0
Community Wiki and Resources
Download Client Library
Python Client Library
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
4 Store Operations
Chapter Sections
Chapters

4.2. Set Operations

The set operations store a value into Couchbase using the specified key and value. The value is stored against the specified key, even if the key already exists and has data. This operation overwrites the existing with the new data.

API Callobject.set(key, expiry, flags, value [, vbucket ])
Asynchronousno
Description Store a value using the specified key, whether the key already exists or not. Will overwrite a value if the given key/value already exists.
Returnsobject ( Binary object )
Arguments 
key Document ID used to identify the value
expiry Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch).
flags Flags for storage options. Flags are ignored by the server byt preserved for use by the client.
object value Value to be stored
String vbucket Name of the vBucket to be used for storage.

The first form of the set() method stores the key and sets the expiry (use 0 for no expiry).

The simplest form of the command is:

couchbase.set("someKey",0,0,someObject)