Caching Data
-
hello :)
i'm using QNetworkAccessManager to get web service data
i want to cache the recieved data so that when there is no connection i got the data from cache
@
QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
diskCache->setCacheDirectory("cacheDir");
manager->setCache(diskCache);
QNetworkRequest req(url);
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
@it get what has been cashed before and don't look 2 the server
so i change this attribute 2 be
@
req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
@
but when there is no connection it got no data
what can i do???
by the way how i specify the path it will save data on the mobile?
@
diskCache->setCacheDirectory("cacheDir");
@
is this line create directory on project path??
thanks in advance for your help :)