0

How do I disable query cache for AWS Dynamo DAX? The answer at Can we have infinite TTL for DAX item cache mentions setting the ttl to 0 would just make the query results to live ever till eviction.

  • Why do you want to disable the query cache? This would be equivalent to read directly from the underlying dynamodb table. DAX implements the same interface as dynamodb. You can write your code to directly query dynamodb instead fairly easily and keep calling dax for the item cache. – jackdbernier Oct 27 '19 at 19:18
  • Some of my queries require strong consistency whereas some others don't. The problem is there is no table or query specific setting to disable or enable the cache. – tick_tack_techie Nov 09 '19 at 19:46
  • https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.consistency.html#DAX.consistency.strongly-consistent-reads “ To perform a strongly consistent GetItem, BatchGetItem, Query, or Scan request, you set the ConsistentRead parameter to true. DAX passes strongly consistent read requests to DynamoDB.” – jackdbernier Nov 10 '19 at 04:55

1 Answers1

2

If you need specific queries to be strongly consistent, DAX will honor that parameter if you pass it in the API call.

To perform a strongly consistent GetItem, BatchGetItem, Query, or Scan request, you set the ConsistentRead parameter to true. DAX passes strongly consistent read requests to DynamoDB.

Source https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.consistency.html#DAX.consistency.strongly-consistent-reads

The other possibility is to use 2 clients. The DAX one for queries that you want cached and the dynamodb one for queries that you need to bypass the cache. Since DAX implements the sam API as dynamodb, it shouldn’t be too hard to implement.

jackdbernier
  • 1,542
  • 1
  • 17
  • 32