File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,12 @@ For the moment, only `http` events are supported
4949 should be added to all http handle lambdas.
5050 - ` authorizers ` : a map of global authorizers that will be available to
5151 Serverless http event authorizer configuration as ` arn ` s
52- - ` authorizersCacheSet ` a ` function(key, item , ttl) ` used to set an entry
52+ - ` authorizersCacheSet ` a ` function({ key, value , ttl}, cb ) ` used to set an entry
5353 in a custom cache to save calls to the authorizer. ttl defaults to 300 (ms)
5454 and should be used to invalidate the cache if a ` authorizersCacheGet ` is
55- received after that time.
56- - ` authorizersCacheGet ` a ` function(key) ` used to retireve a cached item.
57- This function should return a falsy value if there is no cache for the given
58- key or if the cache item is expired.
55+ received after that time. The callback ` cb ` should be called after the cache
56+ has been set.
57+ - ` authorizersCacheGet ` a ` function(key, cb) ` used to retireve a cached item.
58+ This function should call the callback with a falsy value if there is
59+ no cache for the given key or if the cache item is expired. The callback is
60+ a ` function(error, value) ` .
Original file line number Diff line number Diff line change @@ -26,13 +26,15 @@ const send200 = (req, res) => res.sendStatus(200);
2626// should be added to all http handle lambdas.
2727// - `authorizers`: a map of global authorizers that will be available to
2828// Serverless http event authorizer configuration as `arn`s
29- // - `authorizersCacheSet` a `function(key, item , ttl)` used to set an entry
29+ // - `authorizersCacheSet` a `function({ key, value , ttl}, cb )` used to set an entry
3030// in a custom cache to save calls to the authorizer. ttl defaults to 300 (ms)
3131// and should be used to invalidate the cache if a `authorizersCacheGet` is
32- // received after that time.
33- // - `authorizersCacheGet` a `function(key)` used to retireve a cached item.
34- // This function should return a falsy value if there is no cache for the given
35- // key or if the cache item is expired.
32+ // received after that time. The callback `cb` should be called after the cache
33+ // has been set.
34+ // - `authorizersCacheGet` a `function(key, cb)` used to retireve a cached item.
35+ // This function should call the callback with a falsy value if there is
36+ // no cache for the given key or if the cache item is expired. The callback is
37+ // a `function(error, value)`.
3638module . exports = function ( options ) {
3739 // Validate options
3840 const httpConfig = options && options . http ;
You can’t perform that action at this time.
0 commit comments