send key in protocol
put policy has various options
put
(key, bins[, meta[, policy[, serializer]]])Write a record with a given key to the cluster.
Parameters: |
|
---|---|
Raises: | a subclass of |
Write Policies
policy
A
dict
of optional write policies which are applicable toput()
. See Policies.- timeout write timeout in milliseconds
- key one of the aerospike.POLICY_KEY_* values
- exists one of the aerospike_POLICY_EXISTS_* values
- gen one of the aerospike.POLICY_GEN_* values
- retry one of the aerospike.POLICY_RETRY_* values
- commit_level one of the aerospike.POLICY_COMMIT_LEVEL_* values
import aerospike
import time
config = {
'hosts': [('192.168.1.1',3000)],
'policies' : {'timeout':10000}
}
client = aerospike.client(config)
client.connect()
# key = (namespace, set, key)
key = ("test","demo123","foo")
rec = {
'uid': 'choonho',
'name': 'Son Choonho',
'dob': '19xx',
'avator': 'http://www.xxx.xxx',
'points': 167
}
print "connecting ...:", client
print "start put"
print client.put(key, rec, policy={'key':aerospike.POLICY_KEY_SEND})