how to use cache ?

D

dave

hi
I'm building a page that displays all phone in phoneview.asp...however from admin section we can add new phone image tht stores path in database.
I wanna use cache object in phoneview.asp..becoz most of the time images r same..
so i just need to store image in cache...but not data..becoz asp page reads all phone list information from database and displays all phones...
so is it possible to store image in cache so it can be served quickly if its in list...
any help would be appreciated...
thanx in advance...
dave
 
R

Roland Hall

in message
*looking at the subject" My ex can tell ya' how to do that. So can her
attorney.

: I'm building a page that displays all phone in phoneview.asp...however
from admin section we can add new phone image tht stores
: path in database.
: I wanna use cache object in phoneview.asp..becoz most of the time images r
same..
: so i just need to store image in cache...but not data..becoz asp page
reads all phone list information from database and displays all
: phones...
: so is it possible to store image in cache so it can be served quickly if
its in list...

Are you referring to preloading images into cache?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
D

dave

I'm not sure..
I need sth like when you hit page and image is available in cache it shuld
display from cache rather than downloading from web server...
i m displaying 50 phone images on page...so each time its downloading from
web server...and takes bit long...
i dont know abt preloading images into cache...
just wanna know whats the best way to do it..
thnx
dave
 
R

Roland Hall

in message : I'm not sure..
: I need sth like when you hit page and image is available in cache it shuld
: display from cache rather than downloading from web server...
: i m displaying 50 phone images on page...so each time its downloading from
: web server...and takes bit long...
: i dont know abt preloading images into cache...
: just wanna know whats the best way to do it..

Ok, well you can wrap it in server-side script but I think this is
considered a client-side issue.

The way I understand it is when a page loads, the browser will render
elements that display on screen. So, if you have images, they will load one
at a time and if the user is on a dialup, they may see the image being drawn
as it is loaded. Obviously a high speed connection this is less noticeable.

When you reload a page that has already downloaded these images, they all
appear to load at once or "blink" on as people call it. The reason for this
is because the file is stored locally on the user's system in cache which
MSFT calls Temporary Internet Files. To get this same effect every time,
developers have figured out a way to preload the images before they appear
so when called for them on the page, they appear immediately.

I have a pretty elaborate preload routine but it can be as simple as this:

<script type="text/javascript">
// preload images into cache
if(document.images) {
var img1 = new Image();
img1.src = '/images/image1.jpg';
var img2 = new Image();
img2.src = '/images/image2.jpg';
}
function showImages() {
// display images on screen
document.getElementById('img1').src=img1.src;
document.getElementById('img2').src=img2.src;
}
</script>
</head>
<body onload="showImages()">
<img id="img1" src="" /><br />
<img id="img2" src="" /><br />

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top