Skip to content

Commit

Permalink
lambda readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcj committed Feb 15, 2021
1 parent 141a0e0 commit 8e15f7b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ require 'fulfillment-outbound-api-model'
config.aws_secret_access_key =
config.region = 'eu'
# config.debugging = true

# optional lambdas for caching LWA access token instead of requesting it each time, e.g.:
config.save_access_token = -> (access_token_key, token) do
Rails.cache.write("SPAPI-TOKEN-#{access_token_key}", token['access_token'], expires_in: token['expires_in'] - 60, race_condition_ttl: 1.minute)
end
config.get_access_token = -> (access_token_key) { Rails.cache.read("SPAPI-TOKEN-#{access_token_key}") }
end

begin
Expand Down

0 comments on commit 8e15f7b

Please sign in to comment.