Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

lambda-cache

Package to cache objects in memory for NodeJS Lambda Functions

How to use

import{APIGatewayEvent}from'aws-lambda';import{Cache}from'./cache';constcache=newCache();exportconsthandler=async(ev: APIGatewayEvent)=>{consttestKey="testkey";constval=cache.get(testKey);if(val){console.log("Cache hit")return{statusCode: 200,body: JSON.stringify(val),headers: {'Content-type': 'application/json'},};}console.log("Cache miss");lettest={"k":"testing"};cache.set("test",test,10);// cache object for 10 secondsreturn{statusCode: 200,body: JSON.stringify(test),headers: {'Content-type': 'application/json'},};}

About

in memory cache for AWS Lambda

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages