title: Aerospike as a deduplication cache
body: <p>We wanted to use Aerospike as a cache for deduplication of event ids, with a predefined TTL.</p>
  
  <p>Our use case is very simple: For every event that we receive, we would like to check if this event id exists in the cache or not. If it does, we would want to reset the TTL (touch the record) and mark this event as a fraud in our application, else we would like to do a put operation to insert this id.</p>
  
  <p>What we are planning to do is the following:</p>
  
  <p>(i) Configure a single record namespace since the only thing we wish to store is the id. We will use the event ids as the keys, and store NullValue as the corresponding value. (Since we really don't need anything other than the key value).</p>
  
  <p>(ii) For the deduping check, we will first check client.exists() and then do a put operation with RecordExistsAction.REPLACE in the write policy (since this is optimized for performance). Both of these operations will be called in an operate() block for atomicity.</p>
  
  <p>But we had a few queries regarding the following:</p>
  
  <p>(i) Regarding the operate block, this check and set transaction that we wish to do seems to be a very common use case. Is there an API that achieves this in a cleaner manner? (We could not find anything)</p>
  
  <p>(ii) Is it absolutely necessary to have even a single bin? We only wish to store the keys and no corresponding value. I realize that the key value isn't ever stored and Aerospike only stores the digest but since exists() is the only thing we care about, is there any way to get rid of the extra bin storage overhead?</p>
  
  <p>Thank you!</p>