-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
endpoint caching with redis #28
Conversation
import { createClient } from "redis"; | ||
|
||
const redisClient = createClient({ | ||
url: process.env.REDIS_URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh is this connection with redis via url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, although I saw you configure with additional stuff like tls
key
cert
ca
. Should I do the same? and can you give me the url for the site you took references from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually i did it as like in the redis documentation, but i saw people do like this "url" thing too. I think it's better way since you don't really need to config stuff like port and host and password?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well.. a url is basically put everything in one line XD
redis://<username>:<password>@<host>:<port>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, although I saw you configure with additional stuff like
tls
key
cert
ca
. Should I do the same? and can you give me the url for the site you took references from?
Isn't the TLS, Cert, CA and Key thing for SSL? If the service needs to go through SSL, wouldn't it need that configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to go through SSL? It's an internal docker network anyway though
redis://USERNAME:PASSWORD@redis:6379
4d7c36d
to
b1b411d
Compare
Create a middleware that attempts to get cached data using URL path as key,
if data is found, simply return it
if not, retrieve data from the source and cache it (expires after 1 week)