syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
In Aerospike how to create temporary data?
Aerospike offers the useful feature of allowing me to create temporary records in a set:
import aerospike
config = {'hosts': [('127.0.0.1',3000)]}
client = aerospike.client(config).connect()
mynamspace  = 'test'
myset       = 'secrets'
myrecpk     = 100
namebin     = 'msg100'
foodbin     = 'Lasagna is for dinner'
myrecord    = {'namebin': namebin, 'foodbin': foodbin}
keytuple    = (mynamspace,myset,myrecpk)
exp_in_meta = {'ttl': 60*60} # seconds
client.put(keytuple, myrecord, exp_in_meta)
After 60*60 seconds, record msg100 should disappear from test.secrets.

syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me