Reputation: 13212
I know that the AmazonDynamoDBClient
is thread-safe and I can init a singleton when my app starts and keep using it throughout the apps lifetime.
Does the same apply to DynamoDBContext
?
Upvotes: 5
Views: 1515
Reputation: 1286
Yes, the DynamoDBContext is thread-safe.
It also maintains a number of caches (like table descriptions) which are populated from DynamoDB, so it's best to keep an instance around for as long as possible. This will help avoid making extra service calls to repopulate the caches.
Upvotes: 10