Current CTO exploring entrepreneurship on the side; coach; mentor; instructor.
Dedicated to promoting digital literacy and ideological diversity in tech.
You typically only cache get requests, and there are services that already exist to do this.
Redis is a very popular one. When a get request is made, you push the result set to redis and store it there for x seconds.
Then every subsequent identical get request would pull the results from redis instead of the database as long as the result set hasn't expired yet.
How you implement this is typically by watching for http caching headers, and determining which of your get requests have low enough turnover that caching is effective.
For example, if your get request relies on having live data, (like getting a count of invoices), then caching might not make sense. You have to decide what level of caching is appropriate for your application.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You typically only cache get requests, and there are services that already exist to do this.
Redis is a very popular one. When a get request is made, you push the result set to redis and store it there for x seconds.
Then every subsequent identical get request would pull the results from redis instead of the database as long as the result set hasn't expired yet.
How you implement this is typically by watching for http caching headers, and determining which of your get requests have low enough turnover that caching is effective.
For example, if your get request relies on having live data, (like getting a count of invoices), then caching might not make sense. You have to decide what level of caching is appropriate for your application.