Skip to content

benbpyle/lambda-extension-cache

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
lib
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Lambda Extension Cache Sample

Sample repository that supports this article Binaryheap

Building

make deploy

# change the code in the infra/lib/sample-fuc.ts to use the new layer
# that you just uploaded

cdk deploy

Testing the Extension

What would a walkthrough be without showing you how to execute the code :). So when building a Lambda Extension with Golang, your primary handler can be anything you want. The event source might be Kinesis, SQS, EventBridge or whatever. In this case, I'm using API Gateway.

Lambda Design

First, let's put a record in the DynamoDB CacheSample table.

{
    "id": "1",
    "fieldOne": "abc",
    "fieldTwo": "def"
}

Now, let's make the API GET request via curl to run the API.

Lambda curl

So if you remember our extension was a read-through cache implementation. The first time through, it'll miss on the cache, then read from DynamoDB and then write the cache into the store. The second time through, you'll get the hit and return.

First time:

First time

Second time: Second time

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published