Skip to content
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

3 - Add Middleware for caching GET requests #3

Open
glmaljkovich opened this issue Mar 20, 2019 · 0 comments
Open

3 - Add Middleware for caching GET requests #3

glmaljkovich opened this issue Mar 20, 2019 · 0 comments

Comments

@glmaljkovich
Copy link
Contributor

Our DB is very slow, our code very inefficient and our RAM is huge so we want to caché all the GET requests to our endpoints. Since we are not so naive, we know we need to invalidate that caché.

For that reason we want you to implement a middleware that does 2 things:

  • For every GET request we want you to save the response body to a global dictionary with the key being the request url for easy access. Next time someone asks for that path, you return the cache value instead of doing the controller call.

  • For every POST and PUT we want you to go that dictionary and clear the value. And any other cached value that might use that resource.

We don't want to caché the route /api/admin/billing/getChargeableStudents and might not want to caché other routes in the future.

Remember in order to capture the data sent on a response we can always redefine the res.response200 method in a new middleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant