Hi Fabien,
Thanks and sorry for only getting back to you now.
This is weird, it is the same:
Zend_Service_Flickr_ResultSet Object
(
[totalResultsAvailable] => 229
[totalResultsReturned] => 10
[firstResultPosition] => 1
[_results:protected] => DOMNodeList Object
(
)
[_flickr:private] => Zend_Service_Flickr Object
(
[apiKey] => 03ba312703abdbf3cfb59160c8d1a27a
[_restClient:protected] => Zend_Rest_Client Object
(
[_data:protected] => Array
(
)
[_uri:protected] => Zend_Uri_Http Object
(
[_username:protected] =>
[_password:protected] =>
[_host:protected] => www.flickr.com
[_port:protected] => 80
[_path:protected] => /services/rest/
[_query:protected] =>
[_fragment:protected] =>
[_regex:protected] => Array
(
[alphanum] => [^\W_]
[escaped] => (?:%[\da-fA-F]{2})
[mark] => [-_.!~*'()\[\]]
[reserved] => [;\/?:@&=+$,]
[unreserved] => (?:[^\W_]|[-_.!~*'()\[\]])
[segment] =>
(?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)
[path] =>
(?:\/(?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)?)+
[uric] =>
(?:[;\/?:@&=+$,]|(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2}))
)
[_scheme:protected] => http
)
)
)
[_currentIndex:private] => 0
)
How would I go about caching this result? To display the images I simply to
a foreach() loop of the result I get back and when its fresh there are
actually items in the $results array, but when loaded out of cache that
array is empty when I foreach it (even though the print_r) shows the same. I
am seriously confused :/
Thanks
Ian
On Fri, Nov 7, 2008 at 6:55 PM, Fabien MARTY <[EMAIL PROTECTED]> wrote:
> sorry but your two print_r dumps seems to be the same ?
>
> can you be more precise and showing us the differences ?
>
> I don't know if it's the problem here. But don't forget that PHP
> serialization doesn't work with resources
>
>
>
>
> Ian a écrit :
>
>> Anyone have an ideas on this? Im still stuck...
>>
>> On Wed, Nov 5, 2008 at 10:26 AM, Ian <[EMAIL PROTECTED] <mailto:
>> [EMAIL PROTECTED]>> wrote:
>>
>> Hi,
>>
>> I am having problems using Zend Cache and Service Flickr. The
>> problem is that the array I get before caching is very different
>> from the cache. Any ideas as to what im doing wrong? Here is my code:
>>
>> require_once('Zend/Loader.php');
>> Zend_Loader::registerAutoload();
>> Zend_Loader::loadClass('Zend_Cache');
>> Zend_Loader::loadClass('Zend_Service_Flickr');
>> Zend_Loader::loadClasS('Zend_Service_Flickr_ResultSet');
>>
>> /* Setup cache options */
>> $frontendOptions = array(
>> 'caching' => true,
>> 'lifetime' => 600, // cache lifetime of 10 minutes
>> 'automatic_serialization' => true
>> );
>> $backendOptions = array(
>> 'cache_db_complete_path' => '/cache/cache.sqlite'
>> );
>>
>> /* Init both vars */
>> $cache = Zend_Cache::factory('Core', 'Sqlite', $frontendOptions,
>> $backendOptions);
>> $flickr = new Zend_Service_Flickr('');
>>
>>
>> if(!$results = $cache->load('flickrcache'))
>> {
>> $results = $flickr->groupPoolGetPhotos('');
>> $cache->save($results, 'flickrcache');
>> }
>>
>> The print_r now shows this when retreived from cache:
>>
>> Zend_Service_Flickr_ResultSet Object
>> (
>> [totalResultsAvailable] => 215
>> [totalResultsReturned] => 10
>> [firstResultPosition] => 1
>> [_results:protected] => DOMNodeList Object
>>
>>
>> (
>> )
>>
>> [_flickr:private] => Zend_Service_Flickr Object
>> (
>> [apiKey] => [_restClient:protected] =>
>> Zend_Rest_Client Object
>> (
>>
>>
>> [_data:protected] => Array
>> (
>> )
>>
>> [_uri:protected] => Zend_Uri_Http Object
>> (
>> [_username:protected] =>
>>
>> [_password:protected] =>
>> [_host:protected] => www.flickr.com <http://www.flickr.com>
>> [_port:protected] => 80
>>
>>
>> [_path:protected] => /services/rest/
>> [_query:protected] =>
>> [_fragment:protected] =>
>> [_regex:protected] => Array
>>
>>
>> (
>> [alphanum] => [^\W_]
>> [escaped] => (?:%[\da-fA-F]{2})
>> [mark] => [-_.!~*'()\[\]]
>>
>>
>> [reserved] => [;\/?:@&=+$,]
>> [unreserved] =>
>> (?:[^\W_]|[-_.!~*'()\[\]])
>> [segment] =>
>> (?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)
>>
>>
>> [path] =>
>> (?:\/(?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)?)+
>> [uric] =>
>> (?:[;\/?:@&=+$,]|(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2}))
>>
>>
>> )
>>
>> [_scheme:protected] => http
>> )
>>
>> )
>>
>> )
>>
>> [_currentIndex:private] => 0
>> )
>>
>>
>>
>> And this when loaded originally:
>>
>> Zend_Service_Flickr_ResultSet Object
>> (
>> [totalResultsAvailable] => 215
>> [totalResultsReturned] => 10
>> [firstResultPosition] => 1
>>
>> [_results:protected] => DOMNodeList Object
>> (
>> )
>>
>> [_flickr:private] => Zend_Service_Flickr Object
>> (
>> [apiKey] => [_restClient:protected] =>
>> Zend_Rest_Client Object
>>
>>
>> (
>> [_data:protected] => Array
>> (
>> )
>>
>> [_uri:protected] => Zend_Uri_Http Object
>> (
>>
>>
>> [_username:protected] =>
>> [_password:protected] =>
>> [_host:protected] => www.flickr.com <http://www.flickr.com>
>>
>>
>> [_port:protected] => 80
>> [_path:protected] => /services/rest/
>> [_query:protected] =>
>> [_fragment:protected] =>
>>
>> [_regex:protected] => Array
>> (
>> [alphanum] => [^\W_]
>> [escaped] => (?:%[\da-fA-F]{2})
>>
>>
>> [mark] => [-_.!~*'()\[\]]
>> [reserved] => [;\/?:@&=+$,]
>> [unreserved] =>
>> (?:[^\W_]|[-_.!~*'()\[\]])
>>
>>
>> [segment] =>
>> (?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)
>> [path] =>
>> (?:\/(?:(?:(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2})|[:@&=+$,;])*)?)+
>>
>>
>> [uric] =>
>> (?:[;\/?:@&=+$,]|(?:[^\W_]|[-_.!~*'()\[\]])|(?:%[\da-fA-F]{2}))
>> )
>>
>> [_scheme:protected] => http
>>
>>
>> )
>>
>> )
>>
>> )
>>
>> [_currentIndex:private] => 0
>> )
>>
>>
>> Any ideas ?
>>
>> Thanks
>> Ian
>>
>>
>>
>