envelop
envelop copied to clipboard
feat(response-cache): add response-cache-upstash
Add redis cache using stateless HTTP connections instead of TCP with Upstash Redis.
Description
This is basically a copy of response-cache-redis where I changed a few details to make it work with @upstash/redis http client.
Implements #1218
Type of change
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
- Create a free database on Upstash
UPSTASH_REDIS_REST_URL=".." UPSTASH_REDIS_REST_TOKEN=".." yarn test
Test Environment:
- OS: macOS 12.4
- NodeJS: 16.15.0
Checklist:
- [x] I have followed the CONTRIBUTING doc and the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented on my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream modules
Further comments
I haven't figured out why the tests are not passing yet, to me it seems unrelated to the implementation but I will take another look this week. It writes and reads from the cache but for some reason doesn't use the cache sometimes.
Hey @chronark, tests here are currently failing because we are still running tests against Node.js version 12. After https://github.com/n1ru4l/envelop/pull/1417 is merged, you can rebase this branch. 😇
@chronark We will delay dropping Node.js 12 support until The Yoga v3 launch (https://github.com/dotansimha/graphql-yoga/issues/1358). Is there an alternative (older) version of @upstash/redis, that still supports Node.js 12?
Hmm, v1.3.0 or older might still work. But I'm not 100% sure. I won't have time this week but I'll add it to my todo list.
⚠️ No Changeset found
Latest commit: fb47e92b305704ea6fd963315096fb29c5cc9f98
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@chronark is attempting to deploy a commit to the The Guild Team on Vercel.
A member of the Team first needs to authorize it.
@chronark hey, we dropped Node 12 support by now - do you mind rebasing this PR?
@n1ru4l I'll put it on my todo list for this or next week thanks for letting me know
Hey @chronark, that's a neat plugin. Could you please rebase this PR?
Can't really get the tests to pass right now and I'm not sure why It definitely caches data to redis. I'll give this another shot tomorrow