Slashdot Mirror


Load List Values for Improved Efficiency

An anonymous reader writes "Reduce the number of database hits and improve your Web application's efficiency when you load common shared list values only once. In this code-filled article, learn to load the values for drop-down lists when your Web application starts and then to share these loaded list values among all the users of your application."

2 of 207 comments (clear)

  1. Re:Changes to the lists? by Flibz · · Score: 2, Interesting

    I find that something that helps there, particularly if different users have diferent data for the list is to use javascript.

    Basically, create a session variable for the user (we'll call it cacheTimeStamp) with the current date/time to the hour (i.e. yymmddhh).

    When the page with the drop-down list is called, check current timestamp. If it's expired, create a new javascript .js file & delete the old one.

    Then, when the <script> tag is called, use thecacheTimeStamp value to ensure a current .js file is called and let the client browser handle the caching...

  2. Not that bad a hint. by Ancient_Hacker · · Score: 2, Interesting
    Yes, it's obvious to anybody with half a brain. But from the looks of several apps out there, there's a LOT of coding being done by the lower half of the bell curve:
    • One very old 200,000 line app, written in assembler, that could only ever run on one particular CPU, had a #define for the number of bits in a packed character field (6 bits BTW).
    • One really losing Java app does about a bazillion (200+) separate SQL queries to ask for things that have not changed in 50 years. Funny, the app runs slowly, even on a rather hefty server cluster. It runs much slower than the old CICS mainframe app it replaced, which ran in one 30 MHz CPU, 4MB of RAM.
    • Many apps do SQL queries to get the names of the days of the week. And the names of the months. And the abbreviations for same.
    • It's a