简体   繁体   中英

Do PynamoDB support AWS DAX?

I am using PynamoDB for accessing my AWS DynamoDB tables, Now I need to implement the caching via AWS DAX .

Does PynamoDB support DAX , even if some source code changes are required to make it work , I can do it myself too. Kindly guide me accordingly.

I forked from uncovertruth/PynamoDB which added the support for DAX. you can install it with

pip install dynamodb-dax

usage example here

class CacheModel(Model):
    """
    A DynamoDB Caching table
    """
    class Meta:
        table_name = "cachingDax"
        region = 'us-east-1'
        dax_read_endpoints = ['example.cache.amazonaws.com:8111']
        dax_write_endpoints = ['example.cache.amazonaws.com:8111']
    cacheKey = UnicodeAttribute(hash_key=True)
    data = JSONAttribute(default={})

Note:

  • The dax endpoints must be a list of strings
  • You must be in the same VPC as the Dax cluster

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM