Search code examples
performancecachingibm-mobilefirstmobilefirst-adaptersmobilefirst-server

Is there a way to cache the response received from a HTTP adapter?


Is there a way to cache the response received from a http adapter in IBM MobileFirst Platform?

It would be more efficient to get data from cache for frequently used services instead of hitting the service again and again. Even an adapter(server) side caching would reduce response times considerably.

Is there a way to achieve this in IBM MobileFirst?


Solution

  • There is no built-in mechanism to cache an adapter response.

    Maybe this will give you a way to do it: use Java in order to "manage" the caching. You'll need to implement the logic to:

    1. Preserve the data in memory (in variables...)
    2. Decide when to return the cached data
    3. Decide when to purge the data and pass the request to the backend

    If using JavaScript adapters, you can invoke Java code
    If using Java adapters (starting MobileFirst Platform Foundation 7.0), implement it there...

    Perhaps you could also use a CDN, where you'll need to store data and decide in your logic when to reach to the CDN and when not to.