I am new to this forum. We need help for one of our use case.
We are stuck with one of our use case and trying to solve it without UDF or LUA, .i.e through single client call.
Application on which we are currently working support high TPS. So We don’t want to do multiple round trips to Aerospike from our java application.
Scenario ,:
We have 8 counter bins against a key let say “customerId”
Bins:
quota : Maximum cap on usage
Sun: Sunday total used quota
Mon: Monday total used quota
Tue: Tuesday total used quota
… so on for full week
Now we are incrementing counter in the bin which points to todays day of week.
But white doing this increment, we have to stop if
{Value(quota) - [Value(Sun) + Value(Mon) + ...+ Value(Sat)] } < 0.
It means, all quota has been exhaust. We want to stop incrementing in bin if this formula returns 0.
Also there are scenarios in failure of task, we have to decrement current day usage counter. And a background daily job for T-2 day, recalculate used quota and decrement used value from Quota bin and reset that day bin value to 0.
BTW, you could save a bit of storage by using a list of counters instead of 8 bins - but you would then need to use expressions to increment the counters.
PredExp is the older (deprecated) way to specify conditional operations. You can find it the 4.1.2 Java client documentation. It seems PredExp should allow you to do what you are trying. However, you may want to consider upgrading to the releases that support FilterExpression, as the PredExp code will not work in a future release when the support for it is withdrawn.
Thanks for help we upgraded the Aerospike to use FilterExpression. Also we need bin convergence too to support write on same key in cross cluster (XDR)