Http Cache

Caching HttpMessageHandlerRequest(s) - HttpCache

Android (HttpResponseCache) and iOS (NSURLCache) provide a possebility to cache all requests that are made to a web-api on the local file system. The cache is set up with a given size on start of the application.

Usecase 1: Caching over App-live-time: We are requesting the configuration (json) from the server every time the app starts. The HttpCache should check for changes on the server and only download changes if there are some.

Usecase 2: Caching during runtime: Images from the server are optained by sending a HttpMessageHandlerRequest. If the HttpMessageHandlerRequest would use the HttpCache, it would automatically cache the Images on the file system.

A feature like this is in the near term road map. Thanks for your input - will add this to the internal ticket :slight_smile:

Has this been released yet?

+1

Yes, this is released. If you use JavaScript it should cache by default if the cache headers is correct. If using Uno you have to set EnableCache to true on your request https://www.fusetools.com/learn/uno/api/uno/net/http/httpmessagehandlerrequest/enablecache_f0c97f29. You can also change this static property if you want to increase size https://www.fusetools.com/learn/uno/api/uno/net/http/httpmessagecache/maxcachesizeinbytes

Anders, can you please elaborate more on “if the cache headers is corrent.”

thank you

If you set the correct headers serverside. I found an article for you that seems to explain this quite well see here