-
Best way to cache data on web server??
Here is my problem...
I have about 9 tables that are pretty much static and i would like to cache
them somewhere, somehow on the server. If i don't do that, everytime a new
user registers i build combo/select/dropdown (whatever you want to call them)
based on these 9 tables so that the user may make a choice. Now that consists
of 9 separate hits on the DB. What is the best way to cache the data and
store it on the server so that the boxes are created from this source instead
of the DB? Naturally i plan to update these table at some predetermined
interval, and allow administrators to do so manually if they add a row to
a table and they know they need to refresh the cache.
-
Re: Best way to cache data on web server??
Joshua,
1. Write code to output the selected name/value pairs from those 9 tables
into a static file, namely "lookup.js" which resides on the server, with
some
contents as follows:
var sLkup = new Array();
sLkup[0] = new Array();
sLkup[0][0] = "";
sLkup[0][1] = "";
sLkup[1] = new Array();
sLkup[1][0] = "00";
sLkup[1][1] = "International";
sLkup[2] = new Array();
sLkup[2][0] = "AL";
sLkup[2][1] = "Alabama";
sLkup[3] = new Array();
sLkup[3][0] = "AK";
sLkup[3][1] = "Alaska";
.........
2. In the form which has the dropdown list, include the above static file:
<script language = "JavaScript" src = "lookup.js">
</script>
.........
' Write client-side script to generate the dropdown list as follows:
<select name = "state" size = 1>
<script language = "JavaScript">
for( kk = 0; kk < sLkup.length; kk++ )
{
document.write( "<option value = \"" + sLkup[kk][0] + "\">" +
sLkup[kk][1] + "\n" );
}
</script>
</select>
3. Whenever one of those 9 tables is updated, the first step is executed
to refresh the contents of "lookup.js" file again.
Is this what you're looking for ? Hope this helps.
kv-
"Joshua Anderson" <janderson@lottery.com> wrote:
>
>Here is my problem...
>I have about 9 tables that are pretty much static and i would like to cache
>them somewhere, somehow on the server. If i don't do that, everytime a
new
>user registers i build combo/select/dropdown (whatever you want to call
them)
>based on these 9 tables so that the user may make a choice. Now that consists
>of 9 separate hits on the DB. What is the best way to cache the data and
>store it on the server so that the boxes are created from this source instead
>of the DB? Naturally i plan to update these table at some predetermined
>interval, and allow administrators to do so manually if they add a row to
>a table and they know they need to refresh the cache.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|