NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: JohanR on August 03, 2026, 11:11:57 PM
-
Hi,
I need a global MEMORY file with about 200 records that should be available to all sessions.
Data in the MEMORY file would be loaded/refreshed once a day
Sessions would read this data and use it in Netwebsource procedures to build HTML using local queues.
What is best practise and best place to load the data for safest and optimal performance.
thanks
Johan
-
For something small like that, you might also consider Capesoft MaxQueue.
As for loading the queue (or file), is the data pre-staged (in which case the load would be almost instantaneous) or does it have to be gathered?
I have some webservers that need the underlying data refreshed periodically. Perhaps I overcomplicate things, but my flow is:
1. When the app starts, START a window that has a timer. Capture the thread returned by the START command into a global variable (I use GLO:DataServiceThread).
2. I declare an equate eqMyClose equate(event:user + 4) 3. In the window that has a timer, in ThisWindow.TakeWindowEvent before the parent
of eqMyClose
! any other cleanup code here
post(event:closewindow) 4. In the webserver procedure, at the beginning of thisWindow.Kill
if GLO:DataServiceThread <> 0
post(eqMyClose,,GLO:DataServiceThread)
end ! if5. Timer in window triggers refresh of data.
6. You might want to wrap the actual reloading of your data inside a critical section to restrict access while the refresh is taking place. Don't know whether that is needed with MaxQueue.
-
Hi Jane
Thanks for the detailed reply,
I like the STARTED procedure with the timer running.
This way if I want to add other similar procedures they will be kept separate and organization will be clean.
Multi-host?
Would this be checked and started from the webserver or webhandler, just thinking about multihost situation.
thanks
Johan
-
Johan,
I've never used the multi-host for a real app; just played with the example.
I would not start from the webhandler.
Many of my web servers actually have a source procedure as the first procedure in the app tree.
This is example code from one that looks at the commandline, does some initialization, starts a timer window, and then runs the web server.
GlobalInit()
IF COMMAND('/setup')
SetupWindow()
RETURN
END ! IF
if GLO:LogMaxRecords = 0
GLO:LogMaxRecords = 500
end ! if
GLO:RunningAsService = gSelfService.AmService
GLO:SuppressUI = GLO:RunningAsService
GLO:DataServiceThread = start(timerwindow,25000)
if GLO:RunningAsService
AddErrorLog('ADIS started as service.')
ELSE
AddErrorLog('ADIS started manually.')
end ! i
GLO:ServerStartDate = today()
GLO:ServerStartTime = clock()
WebServer()