Question

Hi im writing a mobile application client featuring web-requests, through POCO C++ Net-library. However for performance reasons im in need of caching the http responses( response caching to disk). I hear this can be done, but it seems POCO Net lacks this support? Are there any other network libs that supports response caching (Please point me to an example)?

For example if i request a JSON i want to check if the cached version is up-to-date with the server version, before i fetch it, to make the general appearance of the app more smooth.

(I need to use C++ since im developing cross-platform in C++)

Was it helpful?

Solution

There's no out-of-the-box support, but using Cache Framework with a custom strategy based on AbstractStrategy for disk persistence should be straightforward.

Two things to keep in mind:

  1. Cache Framework performance/size penalty (check the linked doc)
  2. Cache-control header:

a response is cacheable if the requirements of the request method, request header fields, and the response status indicate that it is cacheable.

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top