'lo
I've recently redone ForumsPile.com (no, this thread is not a shameless plug), that works by filling Application("TheList") with a string generated from a method that produces a load of <li> elements with the appropriate contents.
...but naturally, whenever the Application is restarted the Application("TheList") gets cleared, resulting in the site being contentless.
But in my Global Application_Start method, I've made a call to the "Populate" method that fills the Application dictionary, but when I logged on this morning I noticed that the list was empty.
Whilst I could add a check to the page's class ("On Page_Load: If Application("TheList") = Nothing Or "" Then Call Populate()") it doesn't seem very elegant.
Does anyone have any suggestions for alternatives (as a way of storing a long string (+60KB) in some kind of non-volatile storage in-memory) or whatever?
I did consider using a database, but it seems like overkill to store a static string.
-
-
you can use the Shared Properties in COM+ ...
I frecuently use them to store values for a lot of different web app.
You must start the Shared Properties the first time ... but not every time that your web app restart
I hope this helps you
bye from Spain
El Bruno
PD: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cossdk/html/31b50c2a-68b5-4816-9a56-8cd9475e7beb.asp -
Maybe you could just store the string in a text file?
You wouldn't have to read the text file every time, load it into an application variable and update that when the text file changes (or when the application restarts). -
W3bbo wrote:'
But in my Global Application_Start method, I've made a call to the "Populate" method that fills the Application dictionary, but when I logged on this morning I noticed that the list was empty.
Weird.
Do what I do with the cache, a static helper object, with static methods which check the cache and reload if necssary (and doing all the casting as well)
-
What I suggest is to have a singleton object inherited from StringDictionary or some String collection and to make a call to populate it (from a text file? tab delimited?) in the constructor, so it will be populated just when it's needed the first time in the current context.
You could then add a FS watcher to look for file changes and recall populate (locking the data structure); this is also a "dirty" way to have, let's say, more worker processes sharing same data and it's not too much "developer time consuming"
.
Anyway, nice idea for the website
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.