TiExtendNW icon indicating copy to clipboard operation
TiExtendNW copied to clipboard

Missing option to activate the cache from Titanium

Open trueter opened this issue 11 years ago • 1 comments

Hey! Nice job wrapping the MKNetworkKit. It really has some nice features we would like to use! Unfortunately I have been unable to activate caching. The MKNetworkKit Documentation states that you have to call this method manually.

[[MKNetworkEngine sharedEngine] useCache];

Did I miss something?

Cheers!

trueter avatar Jan 18 '14 19:01 trueter

@trueter Hi trueter! Thank you for your interest in this module!

Please set "http.cache = true;" after call open method, If you want activate caching.

exp)

var module = require('net.imthinker.ti.extendnw'),
    http = module.createHTTPClient();

http.open('GET', 'http://httpbin.org/ip', {
    forceReload: false
}); // -> Call "self.engine = [MKNetworkkit sharedEngine]" in module.

http.cache = true; // Set [self.engine useCache];

http.send();

MKNetworkKit have not sharedEngine method... I do complicated, but it is necessary to prepare yourself this method (Were prepared methods with the same name referring to the document in this module) . Can you try with this? Thanks!

ryugoo avatar Jan 19 '14 01:01 ryugoo