3
votes

Storing PHP sessions in DynamoDB is pretty cool.

https://docs.aws.amazon.com/aws-sdk-php/v2/guide/feature-dynamodb-session-handler.html

I started using this before DynamoDB introduced the new automatic TTL feature. As I look at it, the "expires" field that the AWS SDK stores in each session record looks like it would be perfect for the attribute to be used by the TTL feature. I played with enabling TTL with this attribute and doing some "preview of items that would expire" and things looked reasonable.

But before I turn this on and break things, I am wondering if anyone else that is more familiar both with PHP sessions in DynamoDB, the SDK support for this, and the DynamoDB TTL feature has done this exact same thing and had it work.

1

1 Answers

3
votes

Well, I waited for a while to get an answer and hearing nothing, I decided to turn on TTL and use the expires field as set by the PHP sessions-in-dynamo code and everything is working very nicely. When I look at metrics and see a few sessions being deleted every few minutes.

The interesting question this raises for me is when and how was PHP expiring the DynamoDB items before I turned on TTL.