Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Caching Questions

Status
Not open for further replies.
Jan 11, 2007
51
0
0
Hello,

I have a page I built that a FLASH movie that loads and XML data file with a bunch of songs in it. It loads very quickly. The problem I'm seeing is that the Images for the songs are loading each time there is a request. I want to cache them (obviously) or load them all at once. I'm not too familair with caching so I'm looking for some guidance.

The images are pulled through from a image processor that resizes them and stuff. Here is the page:


Here is what one "Song" looks like (an xml node)

Code:
<song>
  <title>Happy Valentines Day!</title>  <image>/ImageProc.ashx?Image=albm_16_633069117976359969.jpg&width=75&cropHeight=30</image>
  <mp3Src>SomeMp3.mp3</mp3Src>
  <songId>102</songId>
  <artist>Jenni Quick</artist>
  <fileSize>5895402</fileSize>
  <playTime>4:05</playTime>
</song>


The image proc script is prolly the place to cache the images right? I'd like to load them all... what is the best solution to my problem??

Thank you!!

-- Jenni
 
The best caching choice for this situation isn't through local caching of an object, but through caching the response.

Depending on how you configure it, the caching can be done first on the server, but also on downlevel proxies and the client.

This means instead of clients only repeatedly hitting your site for your cached version of the file, they'll use their own local version of the cache, or one that is stored on a server between yours and theirs. MUCH better performing (potentially).

Here's an overview of the OutputCache directive:
I believe you should just be able to add the following to the top of your .ashx file (duration is the number of seconds to cache):

Code:
<%@ OutputCache Duration="30"
   Location="Any"
   VaryByParam="*" 
%>

MCP, MCTS - .NET Framework 2.0 Web Applications
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top