From 0066637e58ab47c7c1c9dcec123ff850ae33f8fc Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 13 Jan 2016 16:55:44 -0800 Subject: [core] Let SQLiteCache decide when store or refresh responses --- platform/default/online_file_source.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'platform/default/online_file_source.cpp') diff --git a/platform/default/online_file_source.cpp b/platform/default/online_file_source.cpp index 657871b907..a470a83462 100644 --- a/platform/default/online_file_source.cpp +++ b/platform/default/online_file_source.cpp @@ -244,15 +244,8 @@ void OnlineFileRequestImpl::scheduleRealRequest(OnlineFileSource::Impl& impl, bo realRequest = impl.httpContext->createRequest(resource.url, [this, &impl](std::shared_ptr response_) { realRequest = nullptr; - // Only update the cache for successful or 404 responses. - // In particular, we don't want to write a Canceled request, or one that failed due to - // connection errors to the cache. Server errors are hopefully also temporary, so we're not - // caching them either. - if (impl.cache && - (!response_->error || (response_->error->reason == Response::Error::Reason::NotFound))) { - // Store response in database. Make sure we only refresh the expires column if the data - // didn't change. - impl.cache->put(resource, *response_, response_->notModified ? SQLiteCache::Hint::Refresh : SQLiteCache::Hint::Full); + if (impl.cache) { + impl.cache->put(resource, *response_); } response = response_; -- cgit v1.2.1