RikudouSage / DynamoDbCachePsr6Bundle

PSR-6 and PSR-16 cache implementation using AWS DynamoDB for Symfony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The cache table is not created

eerison opened this issue · comments

the initial table cache is not created if it doesn't exist!

after I create the table cache with attribute id manually, the code works

That's by design, this package assumes the table exists. The table should have a primary key id which is a string and a numeric attribute ttl which is set as TTL attribute. You can modify the attribute names, those are just the defaults.

AWS CLI commands to create the table:

  1. export TABLE_NAME=MyCoolCacheTable (change this to your desired table name)
  2. aws dynamodb create-table --attribute-definitions AttributeName=id,AttributeType=S --table-name $TABLE_NAME --key-schema AttributeName=id,KeyType=HASH --billing-mode PAY_PER_REQUEST
  3. aws dynamodb update-time-to-live --table-name $TABLE_NAME --time-to-live-specification Enabled=true,AttributeName=ttl