Skip to content

Does DiskCache work with Netlify functions (AWS lambdas)? #23

Answered by Josh-McFarlin
arpitdalal asked this question in Q&A
Discussion options

You must be logged in to vote

That's a great question. Since Lambda supports tmp, DiskCache should work. If you try it and it does not work, you may need to change the DiskCache dir, you can see this in the Vercel example.

However, tmp only holds up to 512 MB and it will eventually be reset between invocations. If you want better performance (cache more transformations, cache transformations longer, faster loading), a better option would be Lambda EFS. To use EFS, you would need to create your own Cache and provide it to the loader. If this is a small project / performance isn't critical, tmp will work fine and it's free.

Edit: Actually, I have never used EFS in Lambda before, so I was not sure how it worked. After re…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@arpitdalal
Comment options

@Josh-McFarlin
Comment options

@arpitdalal
Comment options

Answer selected by arpitdalal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants