Using the cache?

Topics: Developer Forum, User Forum
Mar 30, 2010 at 10:58 PM

Hi

Great API.

My setup doesn't appear to be using the cache - is there a reason why? I'm not getting any errors and it's enabled ok.

Thanks

Coordinator
Mar 31, 2010 at 9:16 AM

Unfortunately testing of the cache isn't easy as some idea went and made all the classes private (that would be me). I had assumed it was just 'working' but I'll have a look.

Sam

Coordinator
Mar 31, 2010 at 10:06 AM

OK, I've written some quick tests, and from what I can see the Cache is being updated and hit.

What is you setup, and what makes you think that the cache isn't being used?

Sam

Mar 31, 2010 at 10:39 AM

Hey, thanks for replying.

Doing a bit more digging, I was trying to set the cache location using:

Flickr.CacheLocation = somestringpath;

But setting this property appears to make no difference, the API just looks for a cache folder 'FlickrNetCache' in the same directory as the script that's using the API or in the root (I think).

Once i'd esatblished that, no images seem to get written to the cache folder, though i'm only running in debug mode locally at the moment.

Does that make sense or help at all? Is there any other test or investigation you'd like me to try?

Coordinator
Mar 31, 2010 at 11:41 AM

The default location is C:\Documents and Settings\<username>\Local Settings\Application Data\FlickrNet

In what environment are you using the FlickrNet library? Is this a desktop application or a web application?

The FlickrNetCache directory is only used for .Net Compact Framework applications, or at least it should be.

Mar 31, 2010 at 2:07 PM

Ahh ok, I have picked up some second hand code that integrates with umbraco and it comes with a comment to enable that cache directory. It’s clearly wrong.

 

This will be a web app – is there a way to define the location of the cache? I will need to move it for production deployment.

Coordinator
Mar 31, 2010 at 2:23 PM

You can set Flickr.CacheLocation, but that is not saved between web requests. The best way is to use the web.config file:

See the following link for an example: http://flickrnet.codeplex.com/wikipage?title=ExampleConfigFile&referringTitle=Examples

 

<flickrNet apiKey="1234567890abc" secret="2134123" cacheLocation="C:\\FlickrCache" /> 

Sam

 

Jul 12, 2010 at 3:45 AM

I had a hard time figuring out this directory location within a cloud environment, so I used to following code to figure that out:

Response.Write( Server.MapPath("~/directory/") );