This project has moved and is read-only. For the latest updates, please go here.

Cache problems

Dec 1, 2008 at 2:31 PM
Hello, I'm having problems with cache settings with FlickrNet. No images are being cached so every time someone visits the Gallery page, it takes a long time for the page to load (a page with ~15 images as thumbnails).
I made sure to enable caching and assigned a location for it too, created the folder also.

I tried both web.config file and the class methods.

In my web.config I added the following:
<section name="flickrNet" type="FlickrNet.FlickrConfigurationManager,FlickrNet" />

and then
<flickrNet cacheDisabled="false" cacheLocation="/cache" />

I also tried adding the full location string, but nothing happend.
Would be grateful for any help.

Thanks in advance.

Dec 1, 2008 at 2:56 PM
I hope you aren't downloading the images to your server, and then serving them to the user. You should just be sending the URL in the web page and then they would be downloaded directly from the Flickr servers...

If you are serving them from the Flickr web server then caching would make hardly any difference at all.

Without knowing more about your Gallery code I can't say why this would be slow.
Dec 2, 2008 at 7:42 AM
No I'm not downloading the images to my server, just linking the URLs, titles, descriptions and so on.
I've managed to pinpoint at what takes most time and it's when I try to retrieve URLs and Descriptions.
I'll post some code:

        public static string[] GetSetDescriptions(string set)
            Photoset photoset = GetNamedSet(set);
            string[] descriptions = new string[photoset.PhotoCollection.Length];
            int i = 0;

            foreach (Photo photo in photoset.PhotoCollection)
                PhotoInfo pi = flickr.PhotosGetInfo(photo.PhotoId);
                descriptions[i] = pi.Description;
            return descriptions;

        public static string[] GetSetPhotoUrl(string set)

            Photoset photoset = GetNamedSet(set);
            string[] urls = new string[photoset.PhotoCollection.Length];
            int i = 0;

            foreach (Photo photo in photoset.PhotoCollection)
                Sizes sizes = flickr.PhotosGetSizes(photo.PhotoId);
                urls[i] = sizes.SizeCollection[3].Source;

            return urls;

And those use the method:

        public static Photoset GetNamedSet(string set)
            Photoset photoset = null;
            Photosets sets = null;

            if (ItemFunctions.ItemFunctions.IsWta())
                sets = flickr.PhotosetsGetList(wta_userid);
                sets = flickr.PhotosetsGetList(atp_userid);

            foreach (Photoset current in sets.PhotosetCollection)
                if (current.Title == set)
                    photoset = current;

            return flickr.PhotosetsGetPhotos(photoset.PhotosetId);

Does the delay have anything to do that I use flickr.PhotosGetSizes() and flickr.PhotosGetInfo?
Dec 2, 2008 at 7:54 AM
I realized that using photo.MediumUrl returns the same URL so when I changed that method and temporarily removed the description, the gallery loads much faster.
So in the end my final issue I need help with is, is there a way to get description string from a photo without using a flickr method repeatedly?
Dec 2, 2008 at 10:39 AM
There isn't current a way of getting a photos description other than calling photos.getInfo (i.e. Flickr.PhotosGetInfo) for each photo.
Dec 2, 2008 at 10:58 AM
Edited Dec 2, 2008 at 10:58 AM
I see, well thanks for your help anyway.