thisissoon / FM-Frontend-API

A node js middle layer between FM Frontend and FM API
1 stars 0 forks source link

Caching #8

Open edoparearyee opened 9 years ago

edoparearyee commented 9 years ago

How are we going to cache data for our API endpoints?

jamesjwarren commented 9 years ago

We could use redis. We could have a simple service that checks if there is a cached version in redis and whether it has expired or not, then return it or make a new request.

krak3n commented 9 years ago

I would personally go with memcachd

jamesjwarren commented 9 years ago

Are we looking to just cache responses from services or cache our API responses?

krak3n commented 9 years ago

We have yet to look at how caching will work properly but in principle each GET REST response should come with an ETag header - this is a cache key. If the object has not changed the service should return an empty 304 Not Modified so you should dig into your local cache - else if the service returns a 200 OK then you have got some new data and you should update your cache for next time.

edoparearyee commented 9 years ago

I'd imagine caching would done individually on each end point based on how likely they are to change for both data we get from micro services and our own api end points.