Aerospike TTLs on put


I am trying to update .put() into existing records in Aerospike using the python client.

I was excited to discover that you can actually put into existing records and not update the TTL as shown here (meta params): I used to do this by reading the TTL and then re-setting it on the new put.

However, I discovered that when you use the aerospike. TTL_DONT_UPDATE option, the TTL resets to the cold-start-evict-ttl that is set on the namespace. How do I avoid that and just maintain the previous TTL unchanged?


python client aerospike (2.2.3)

aerospike_config = {'hosts': [(<IP1>, 3000), (<IP2>, 3000)], 'policies': {'timeout': 4.0}}

aerospike_client = aerospike.client(aerospike_config)

key = ("namespace", "set", "1234")


	# (('namespace', 'set', None, bytearray(b'')), {'gen': 8, 'ttl': 7265085}, {<data>})

aerospike_client.put(key, {<data>}, meta={'ttl': aerospike.TTL_DONT_UPDATE})


	# (('namespace', 'set', None, bytearray(b'')), {'gen': 9, 'ttl': 4037004360}, {<data>})

aerospike_client.put(key, {<data>}, meta={'ttl': 7265085})


	# (('namespace', 'set', None, bytearray(b'')), {'gen': 10, 'ttl': 7265083}, {<data>})```

* List item


TTL = -2 from client will update record without changing its original TTL but record must exist for you to invoke TTL = -2 on it. This option was introduced in server version 3.10.1.


If you are going to crosspost, it is good etiquette to link to the other post[s]. This helps avoid the ‘Wisdom of the Ancients’ problem in the future.

Also it is, more often than not, helpful to provide versions of the software you are using, such as the Server version or the version of the python client you are using.


Using TTL_DONT_UPDATE plants that -2 value which the server reads as a ‘do not update the TTL’. I’ve checked in a simple script that it works, so I’m not sure how you’re getting this. Sample code, please.


Thanks for your answer, I am using aerospike 2.2.3 at the moment. Is there an equivalent solution without having to update to aerospike 3.10.1 as suggested?

I tried setting ttl=-2 and it doesn’t complain on my client version - it has exactly the same behavior as I described with aerospike.TTL_DONT_UPDATE.

On top of that, I think that the docs are misleading regarding the use of aerospike.TTL_DONT_UPDATE if what I experience is expected, unless I get something wrong.

Thanks again.


Thanks for your answer, I am at v2 at the moment. Is there an equivalent solution without having to update to v3?

What is ‘v2’ and ‘v3’? Are you referring to Aerospike Server 2.x and Aerospike Server 3.x?


Ok, so you are using 2.2.3 of the python client (the current release is 3.0.2 btw).

What version is the Aerospike Server you are connecting to?

One way to determine this is to run:

asadm -h [HOST ADDRESS] -e "asinfo -v 'version'"

You can also collect this information from the python client v 2.2.3 with:

from pprint import pprint

# The client object here needs to be an already connected Python client.




So you will need to upgrade to a Server that is version 3.10.1 or newer to use this feature, I suggest upgrading to the latest 3.13 since you will need to eventually upgrade to that version to upgrade past it.

On you will need to continue to use the method that you had used previously.


Thanks a lot for the help on this. As I said, I neglected the server version which is the issue in this case. Best.