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
                            [_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
                            [_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

Reply via email to