Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4FA56C987 for ; Wed, 19 Jun 2013 11:02:49 +0000 (UTC) Received: (qmail 14054 invoked by uid 500); 19 Jun 2013 11:02:49 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 12829 invoked by uid 500); 19 Jun 2013 11:02:43 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 12674 invoked by uid 99); 19 Jun 2013 11:02:42 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jun 2013 11:02:42 +0000 Received: from localhost (HELO mail-ve0-f177.google.com) (127.0.0.1) (smtp-auth username jonm, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jun 2013 11:02:42 +0000 Received: by mail-ve0-f177.google.com with SMTP id cz10so3842943veb.8 for ; Wed, 19 Jun 2013 04:02:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=CDeY2ocPsPPFdk2dED9pEepyx92dc3SNO7HZrSyGv1U=; b=ROUPrj97N6obhwZC5omP2XCV+d5FmRhjdlkMEPQB+ORHsxvtYNAhgJTjhydpglRa+6 qjeEoOxz1AbqUtDmv+uX6xmN0R7yUlRma3cKKDGiiNEJyo38qMsfVrSF1j6PyC5RbfHV IUnZBYHEPGmD9VLGQV/W0womYobG1fiI9uLVB+IGZG9iRXS/0NU4whaPQ2G44CXUvi2T 9e1LXSNUDTJCa1gmnDDS5DVYR6WWiisJE6KgLUY2yTOU0J0r4z94Ied1hFlnh5G6E19i MTIeoTPsSIrnbsZ6GHrzC/Tl7KIak7UBG970trWhRhjGGkQ2oCnxvfaVK2ubE2ToEXFC fTeA== MIME-Version: 1.0 X-Received: by 10.52.68.129 with SMTP id w1mr648925vdt.53.1371639761068; Wed, 19 Jun 2013 04:02:41 -0700 (PDT) Received: by 10.52.36.20 with HTTP; Wed, 19 Jun 2013 04:02:41 -0700 (PDT) X-Originating-IP: [76.98.205.27] In-Reply-To: <1371314773.11582.10.camel@ubuntu> References: <1371301229.11582.2.camel@ubuntu> <1371305885756.a47f6dc3@Nodemailer> <1371314773.11582.10.camel@ubuntu> Date: Wed, 19 Jun 2013 07:02:41 -0400 Message-ID: Subject: Re: Caching in http-core? From: Jon Moore To: HttpClient User Discussion Content-Type: multipart/alternative; boundary=20cf307f3082b81a4104df7fc45b X-Gm-Message-State: ALoCoQnqYf3T0/II9txZSoFLqt2Y7mEX9lSfROSwJ2dIIZcMT30vOCrowwwdHtQJb+fAh/t2qHsp --20cf307f3082b81a4104df7fc45b Content-Type: text/plain; charset=ISO-8859-1 > On Sat, 2013-06-15 at 07:18 -0700, Sam Perman wrote: > > I think it would be interesting to open those Apis up so the application > could get cache entries for use in certain error cases. (For example, my > client app has detected the server is unavailable for some reason or I have > crossed some throttling limit for requests to the backend... I could choose > not to attempt a call to the backend and just return the cache entry > instead.) > Hi Sam, Many of the features you describe are already available from the httpclient-based caching stack by modifying the requests that are sent. For example, you can add 'Cache-Control: max-stale=31536000, only-if-cached' to requests to prevent origin requests and get at any existing cache entries. The caching stack also supports the stale-if-error (RFC5861) request parameter, and will already return stale cache entries on networking errors during revalidation. Do those support your use cases? The primary reason we've preferred to keep much of the caching APIs private is to allow room for future refactorings without breaking API compatibility. Jon --20cf307f3082b81a4104df7fc45b--