how to use cache ?

Discussion in 'ASP General' started by dave, May 24, 2005.

  1. dave

    dave Guest

    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
     
    dave, May 24, 2005
    #1
    1. Advertising

  2. dave

    Roland Hall Guest

    "dave" wrote in message news:...

    *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
     
    Roland Hall, May 24, 2005
    #2
    1. Advertising

  3. dave

    dave Guest

    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

    "Roland Hall" <nobody@nowhere> wrote in message
    news:...
    > "dave" wrote in message news:...
    >
    > *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
    >
    >
     
    dave, May 24, 2005
    #3
  4. dave

    Roland Hall Guest

    "dave" wrote in message news:...
    : 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
     
    Roland Hall, May 24, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Nokes

    Cache::Cache Stale Segments

    Jeff Nokes, Sep 30, 2003, in forum: Perl
    Replies:
    0
    Views:
    582
    Jeff Nokes
    Sep 30, 2003
  2. DesignerX

    Page.Cache vs HttpContext.Current.Cache

    DesignerX, Jan 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    8,266
    vMike
    Jan 20, 2004
  3. =?Utf-8?B?b25l?=
    Replies:
    1
    Views:
    5,299
    Karl Seguin [MVP]
    Mar 8, 2006
  4. Sergey via DotNetMonster.com

    ASP.NET Cache vs Window System Cache

    Sergey via DotNetMonster.com, Nov 15, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    481
    Sergey via DotNetMonster.com
    Nov 15, 2006
  5. John
    Replies:
    2
    Views:
    1,185
Loading...

Share This Page