Open zdc217 opened 4 years ago
Can cache with a global var.
Example here https://github.com/techservicesillinois/box-team-folders/blob/master/teamfolders/app/teamfolders.py
Per @ddriddle: Here is another example of caching specific to lambda:
# Best practice recommends declaring client as a global variable:
# https://aws.amazon.com/blogs/networking-and-content-delivery/lambdaedge-design-best-practices/
resource: 'DynamoDBServiceResource' = boto3.resource(
'dynamodb',
endpoint_url=os.environ.get('DYNAMODB_ENDPOINT_URL'),
)
QNet work has been on hold due to COVID response and related back-to-school priority efforts.
Per @ddriddle: For this code to be production quality you are going to need to cache the token, and only get a new token when the old token expires...this should be fixed soon.