Skip to content

Instantly share code, notes, and snippets.

@rbotzer
Created February 16, 2020 05:50
Show Gist options
  • Save rbotzer/9f07f15095b5a4380f99993fadbd78ad to your computer and use it in GitHub Desktop.
Save rbotzer/9f07f15095b5a4380f99993fadbd78ad to your computer and use it in GitHub Desktop.
# Fetch the user's segments that are not going to expire today
today = datetime.datetime(now.year, now.month, now.day)
end_ttl = int((today - epoch).total_seconds() / 3600)
print("\nGet only user segments that are not going to expire today")
if options.interactive:
pause()
ops = [
mh.map_get_by_value_range(
"u",
[0, aerospike.null()],
[end_ttl, aerospike.null()],
aerospike.MAP_RETURN_KEY,
True,
)
]
_, _, b = client.operate(key, ops)
print("Show all segments not expiring today:".format(segment_ttl))
print(b["u"])
print(spacer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment