SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Newcastle, England
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about ASP's Application Object

    Last one for today .

    Basically, I'm wondering roughly how much information it's safe to store in the application object. All of the examples/tutorials I've read just say "don't put too much in it", but don't say how much "too much" is.

    I understand the danger of storing arrays in the application object, but what if I wanted to store say a couple of dozen individual strings that might each be up to a few thousand characters in length (so in total they might be ~50Kb). At least some of the strings would be read on every page of the site. Is this a reasonable amount to store? Is it a good idea to store it in the application?

    (Out of interest, the strings would be sort of "templates" of HTML; each one representing a portion ofa page, like one to hold the header HTML, the footer, etc.etc.. I'm wanting to build a system whereby the administator can alter the layout of the pages of the site through a web form, and I'm looking for the most efficient way of storing them. I could use include files everywhere, or read from a database table, but I thought they'd be logical to cache as they're used so frequently. Obviously they'd also be stored in the db or files to survive a reboot, but I thought using the application would speed things up).

    I'd be grateful for any advice (even if it's "don't use the application object for that).

    Cheers
    Nick Wilson [ - email - ]

  2. #2
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    How much you can store in the application object really depends on the server.

    I personnaly would not go with the application object as there are some performance issues there, why not use includes? They are easy to maintain and you can edit/create it using the FSO.

    ASP also has a template class you could use, check out www.4guysfromrolla.com
    .NET Code Monkey

  3. #3
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Newcastle, England
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply (again ). I was thinking of using the application object for efficiency - I was lead to believe that would be faster than using includes, and as it's soemthing that will be used all over the place I thought the time saving would be worthwhile. But I'm happy to be corrected .

    It's difficult to find good tutorials on this kind of subject - there are plenty describing how to use certain things, but not many that explain when one or the other should be used.

    Thanks for the tip on the template class too, I'll head off and check that out now.

    Thanks again
    Nick Wilson [ - email - ]

  4. #4
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI,

    Why not write a little script tp benchmark how long it takes, I would be very interested in the results
    .NET Code Monkey

  5. #5
    code addict Abstraction's Avatar
    Join Date
    Apr 2001
    Location
    Des Moines, IA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't store the html templates in application variables, keep them in your database. You can cache database queries. Keeping them in application vars would be horribly inefficient.

  6. #6
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Newcastle, England
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I'm not quite sure what you mean. If I cache the SQL itself I still have to hit the database every time, which is obviously inefficient. If I cache the recordset that'll be as large as the templates themselves (probably slightly larger), so that's no more efficient.

    Can you explain a little more please, I'm interested ?
    Nick Wilson [ - email - ]


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •