I’m using the Atomic ‘Increment’ function provided by the C# driver for Couchbase which accepts a parameter for passing the expiry as a TimeSpan.
I’m passing the value in the expiry parameter as TimeSpan.FromMinutes(value) , but still after refreshing the couchbase web console, the key does not get deleted after the set time.
Here is the sample code
incrementResult = myBucket.Increment(strKeyName, 1, 1,TimeSpan.FromMinutes(dblTTL));
In the code above variable ‘dblTTL’ is the Minute Property of the TimeSpan variable.
.NET Sdk version - 2.0 , Couchbase Dll version - 220.127.116.11
Any help on this issue will be appreciated !
Never mind, i just figured out the solution.
i made use of the TimeSpan.TotalMinutes property instead of TimeSpan.Minutes as TotalMinutes returns the value as a double which is accurate to the nearest millisecond as compared to Minuteswhich returns just the minutes part of the total duration as an int.
secondly, a key which is initially created without setting a TTL using the atomic increment() function , but later on when trying to increment() the same key now by passing a TTL value did not expire the key.
so if i have to set a TTL to any key using the atomic increment() function i have to make sure that i set its TTL when i create that key for the first time, and not while updating its value later on.