Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Caching a web query?

Received: by 10.42.132.5 with SMTP id b5mr9199504ict.7.1349166454541;
        Tue, 02 Oct 2012 01:27:34 -0700 (PDT)
X-BeenThere: symfony1@googlegroups.com
Received: by 10.43.90.135 with SMTP id bi7ls366841icc.3.gmail; Tue, 02 Oct
 2012 01:27:33 -0700 (PDT)
Received: by 10.50.213.99 with SMTP id nr3mr3612086igc.2.1349166453509;
        Tue, 02 Oct 2012 01:27:33 -0700 (PDT)
Received: by 10.50.213.99 with SMTP id nr3mr3612084igc.2.1349166453500;
        Tue, 02 Oct 2012 01:27:33 -0700 (PDT)
Return-Path: <fe...@f76.eu>
Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177])
        by gmr-mx.google.com with ESMTPS id hr6si1250572igc.0.2012.10.02.01.27.33
        (version=TLSv1/SSLv3 cipher=OTHER);
        Tue, 02 Oct 2012 01:27:33 -0700 (PDT)
Received-SPF: neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of fe...@f76.eu) client-ip=209.85.223.177;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of fe...@f76.eu) smtp.mail=fe...@f76.eu
Received: by ieje14 with SMTP id e14so16840849iej.8
        for <symfony1@googlegroups.com>; Tue, 02 Oct 2012 01:27:33 -0700 (PDT)
        d=google.com; s=20120113;
        h=mime-version:sender:x-originating-ip:in-reply-to:references:from
         :date:x-google-sender-auth:message-id:subject:to:content-type
         :content-transfer-encoding:x-gm-message-state;
        bh=2Fjqt27OQ4lrKlce5WQ89fnCVoLJ8ZZPMlfmqGHauCk=;
        b=JdSOIQVchtXtwmx/vqrCU1xlQMKTlvnTeNdLuMM3lZyAz3kCgmig1qjAf7zPkd8c5K
         M6gbmTbp3z6f5l+Rx8FjnWs/btcrLeVu8h1tRNHuIEZhrp5UeJFdWvuYDVtD/iQZS78B
         H1p9FC8s0b/8l4/eU8D2+ZqcmimGqd8fYCsgktd5QM5PgqqtRelpHBQF88taWiHru2wd
         Dcb0kmP3/gqupbxYzgNlfsNnKLD3Qq+CfXsIOKN/zjbk4ooYjKCpP0CVLzkcY0Y5Fc0f
         QYUJa35Ke0RSceXBoMd3DhiR3LFA+T22E0KkBsXxGoXMdK2kqQl2XVJ07TAR6QYY366s
         26IA==
Received: by 10.50.47.129 with SMTP id d1mr8196719ign.45.1349166453264; Tue,
 02 Oct 2012 01:27:33 -0700 (PDT)
MIME-Version: 1.0
Sender: fe...@f76.eu
Received: by 10.64.18.13 with HTTP; Tue, 2 Oct 2012 01:27:03 -0700 (PDT)
X-Originating-IP: [87.164.216.217]
In-Reply-To: <1258941267-1349157162-cardhu_decombobulator_blackberry.rim.net-2305698...@b11.c20.bise7.blackberry>
References: <CA+m_8J1xReyvnwnE=guRkvMav49MxmgnXHk1Di3Fa3558RC...@mail.gmail.com>
 <1258941267-1349157162-cardhu_decombobulator_blackberry.rim.net-2305698...@b11.c20.bise7.blackberry>
From: "Felix E. Klee" <felix.k...@inka.de>
Date: Tue, 2 Oct 2012 10:27:03 +0200
Message-ID: <CA+m_8J3nc8v+oseJbsAvkJip6vMFwB5+h7iFmy9HR5C8+tM...@mail.gmail.com>
Subject: Re: [symfony1] Caching a web query?
To: symfony1@googlegroups.com
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Gm-Message-State: ALoCoQlsCtosVRtYdEOkK+H+RITrAYJRd90bDqkQ/+dORGevhjCUD3q127+9iA0zwny3qcq7jCRY

On Tue, Oct 2, 2012 at 7:51 AM, =D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB <beste=
stm...@gmail.com> wrote:
> If($value =3D $memcache->get('key')){
>     $value =3D $superModel->queryBank();
>     $memcache->set('key', $value);
> }

Thanks for the suggestion, but the logic would have to be different, as
the bank sometimes has long lasting outages:

   if ($cache->timeoutReached()) {
     if ($newRates =3D queryBank()) {
       $cache->set('rates', $newRates);
     } // else: outage =3D> keep old data
   }
   $rates =3D $cache->get('rates');
   $cache->setTimeoutFromNow(600);