Need to cache personalization data -- not sure which object to use

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: Need to cache personalization data -- not sure which object to use

    Hi Matt,

    Although this might be considered a matter of preference, I'd advise you to
    store "per user" information in Session. The Cache object is application
    scope and does not have dependencies to current user sessions (as does the
    Session object). Data islands are just xml embedded in an html document.
    Viewstate is webform session state control for asp.net interfaces. Asp.net
    uses a cookie to store session data in the client so that each client can be
    uniquely identified and associated to session data stored on the server for
    that specific client.

    The session object is ideal for per user data because it can keep track of
    users that are connected such that a disconnected user's data will be
    dropped after the session expiration time. This will save your web server's
    memory.

    You can enjoy use of the global.asax session_onload to make the call to the
    db to retrieve the specific user's favorites (or use a handler that inherits
    the IRequiresSessionState interface to store the data in session).

    Rein

    "Matt Anderson" <andersonwebdev@hotmail.com> wrote in message
    news:cbb0ed66.0306301200.257d64bd@posting.google.c om...
    > I have used ASP.NET to personalize our company intranet to store a
    > list of hyperlinks to intranet and internet web pages called
    > "favorites". The data is stored in SQL Server, per user, which they
    > can customize any time.
    >
    > I created a user control to display the data in the margin of every
    > page, with DHTML to expand and collapse the folders.
    >
    > The main problem is the performance. I need to cache the favorites,
    > but there are so many choices for this I'm not sure which way to go.
    > Session, Cache object, data islands, viewstate, cookies, etc.
    >
    > One other issue I have is this: There is also an administrative page,
    > which resides in a virtual directory off the root of the same site,
    > which is used by the IT team to administer the favorites data in SQL.
    > There is also of course the page for the employee used to customize
    > the favorites data in SQL. If I use the Cache object, can I force an
    > update of the same cache object/key from both places?
    >
    > Just want to hear what others have tried. Any and all advice is
    > appreciated.

    Rein Petersen Guest

  2. Similar Questions and Discussions

    1. Forcing a data refresh / overriding the cache
      Ok having resolved one issue with how my data was being accessed, I still have another as I suspected. I have a simple app which displays a...
    2. no cache for XML data
      I have a flash .swf that reads from an XML file. This file is updated frequently and I do not want it cached. Should I nocache it in the...
    3. Cache object question
      Use HttpContext.Current.Cache. -- James J. Foster, DotNetCoders http://www.dotnetcoders.com "STom" <stombiztalker@hotmail.com> wrote in...
    4. Using Cache object hanging webserver
      Hi, I'm using the Cache object to persist some values between pages. I'm setting the expiration for 2 minutes. I'm actually storing Bitmap streams...
    5. embed object and no DL to browser cache
      i know this can be done, but i just couldn't figure out how. can someone give me a hint or somthing? it's a asp web application, and i need to...
  3. #2

    Default Re: Need to cache personalization data -- not sure which object to use

    Rein,

    Thanks a million. I like the idea of using the quick-hitting
    superclass table and fetching the data as XML with XSLT. That method
    seems more reliable since it has fewer "moving parts", and I get the
    data back in a ready-to-render format.

    Thanks again.

    Matt

    "Rein Petersen" <rmpetersen@jbogus.hotmail.com> wrote in message news:<#NdPKZLQDHA.2256@TK2MSFTNGP11.phx.gbl>...
    > Hi Matt,
    >
    > > However, when I posted the original message what I was thinking was
    > > how to improve performance even more by only hitting the database only
    > > when the data has changed, not every time the user begins a new
    > > session. I have done this in a couple of web apps where when data is
    > > updated, an XML file of the data is moved by FTP to the production web
    > > servers for publication. When data is needed, a simple, fast XSL
    > > transformation is done without any need to go to the database server.
    >
    > Serializing your data that way makes sense to save trips to the db but
    > introduces concurrency issues such that a user's changes/additions/deletions
    > won't appear immediately in his/her screen. There are options though. You
    > could install MSDE (a light/free version of SQL Server) on each of your web
    > servers (farm?) and replicate data from the main db to each machine -
    > concurrency is still a problem but at least the replication is automated and
    > simple. You add overhead to your web server which will probably reduce
    > performance.
    >
    > You can use the cache object to serialize data (as xml) in a file that even
    > conforms to a schema. It is easily de-serialized in-process. Check out the
    > XSD.EXE tool included with the .NET framework. If the file were made
    > available to the web servers through a UNC addressable share on the db
    > server, a cache dependency could be placed on the file. Next, using the same
    > file as a signal file, an extended stored procedure can be called (by a
    > trigger upon change) to update the timestamp of the file and cause the cache
    > dependancy to drop (then reload fresh version in your code).
    >
    > Or, you can create a superclass table that contains a row for each user's
    > object (his/her favorites relate to a single row in this table) that
    > contains a timestamp which is updated by a trigger (upon change). On the web
    > server, you can still use the session object to store the user's favorites
    > but perform a smaller read to the db to compare timestamp. If the timestamp
    > is different then just reload the data. Since ASP.NET uses connection
    > pooling, your communication to the db will be relatively minor.
    >
    > I would venture the last option is probably the most performant. How you
    > store/serialize the data in session is a matter of preference, but if you
    > enjoy using XSLT, you might as well use SQL's native XML ability. Better
    > yet, SQL has a new XML managed provider that can query data using XPath and
    > returns XML that conforms to a mapping schema. It's quick, simple and ideal
    > for your purposes. Check it out...
    >
    > Rein
    Matt Anderson Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139