What’s the greatest place to implement Redis cache?
API server or frontend? or each?
API shall be utilized in net and cell. I feel I must implement cache in every single place. So it is going to cut back community(if carried out in frontend) calls and db calls(if carried out in api).
Effectively, it actually relies on your wants.
At first you need to implement at backend stage or, perhaps higher, at “API Gateway” stage.
After you have it at backend stage you can too suppose to do some caching at frontend stage. In that case anyway I’d not use Redis for that however simply in reminiscence caching
Effectively, redis is a software program you can solely run in your servers, you can’t ship it to a browser, if thats what you imply by “frontend”.
Neither would a JS working within the browser have the ability to join on to a redis occasion.
So if you wish to use redis as a cache, this places some restrictions on the place to place it.
In fact there are many different caching methods out there, of which some can be utilized on server aspect, and others on the consumer aspect.
All of them have their totally different use circumstances, professionals and cons. All need to take care of cache invalidation, which is without doubt one of the 2 onerous issues in CS…
- Naming issues
- Cache invalidation
- Off-by-one-errors
1 Like