Re: [fw-general] Zend_Cache question

2008-08-12 Thread Jack Sleight

Hi Steven,
Thanks for your reply. In that case, I think I'll use a cache without 
any expiry time, and then use the test() method of Zend_Cache to check 
how old the cached entry is. I can then manually check the date, and if 
it's old try to refresh the data, whether or not that succeeds there 
will still be data available.


Steven Brown wrote:


Hi Jack,

 

From what I know the cache is cleaned automatically, you have no way 
to retrieve something that is cleaned to reset it later.


 

This means you will have to handle this process yourself. I would 
suggest storing the result in a separate file so that if your request 
fails you can load from the file and store it back in cache. If the 
requests succeeds you can store the result in the file and in the cache.


 


Cheers,
Steven

 


*From:* Jack Sleight [mailto:[EMAIL PROTECTED]
*Sent:* Tuesday, 12 August 2008 2:41 AM
*To:* Zend Framework General
*Subject:* [fw-general] Zend_Cache question

 


Hi,
First of all, I don't really know how Zend_Cache works internally, so 
I'm making one (possibly incorrect) assumption, that expired items are 
not removed from the cache until they are requested via $cache-load();


Now, is the following possible, and if so how?

* You have a cache set up where stored items expire after 24 hours
* There is an item in the cache which was added 25 hours ago and
  originally came from a remote source
* You make a request for the item, it has expired, so load()
  returns nothing
* You make a request to the remote system for the latest data
* If the request is successful the new data is added to the cache
  in the usual way
* If the request is unsuccessful the old data that has now expired
  is reset to be valid for another 24 hours (or possibly less)

I want to do this in order to ensure that there is never no data 
available.

Is is possible? Thanks,

--
Jack



--
Jack


RE: [fw-general] Zend_Cache question

2008-08-11 Thread Steven Brown
Hi Jack,

 

From what I know the cache is cleaned automatically, you have no way to
retrieve something that is cleaned to reset it later.

 

This means you will have to handle this process yourself. I would suggest
storing the result in a separate file so that if your request fails you can
load from the file and store it back in cache. If the requests succeeds you
can store the result in the file and in the cache.

 

Cheers,
Steven

 

From: Jack Sleight [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 12 August 2008 2:41 AM
To: Zend Framework General
Subject: [fw-general] Zend_Cache question

 

Hi, 
First of all, I don't really know how Zend_Cache works internally, so I'm
making one (possibly incorrect) assumption, that expired items are not
removed from the cache until they are requested via $cache-load();

Now, is the following possible, and if so how?

*   You have a cache set up where stored items expire after 24 hours
*   There is an item in the cache which was added 25 hours ago and
originally came from a remote source
*   You make a request for the item, it has expired, so load() returns
nothing
*   You make a request to the remote system for the latest data
*   If the request is successful the new data is added to the cache in
the usual way
*   If the request is unsuccessful the old data that has now expired is
reset to be valid for another 24 hours (or possibly less)

I want to do this in order to ensure that there is never no data available.
Is is possible? Thanks,

-- 
Jack