3

Lets say I have a g-wan server with c script, if a http request comes in and then another http request, I would like for both of these running scripts to be able to read and write from the same section of ram.

In other words, I wish to just have a simple RAM database, an array of data and any http request can read from this RAM database.

I mean for any HTTP request to this server, it could be from any client. I just want to be able to read or write from the same data in RAM.

Gil
  • 3,279
  • 1
  • 15
  • 25
Phil
  • 46,436
  • 33
  • 110
  • 175

1 Answers1

4

You can use US_SERVER_DATA:

US_SERVER_DATA,      // global pointer (for maintenance script)
Sean Vieira
  • 155,703
  • 32
  • 311
  • 293
csw
  • 125
  • 6
  • What does for maintenance script mean? – Phil Mar 21 '13 at 12:45
  • Maintenance script = async script that do background works, named main.c in g-wan main directory. – Nagi Mar 21 '13 at 12:58
  • 1
    Also check out this link for persistence pointer of your need: http://gwan.com/source/persistence.c – Nagi Mar 21 '13 at 12:58
  • Unix also supports shared memory that you can use (that's a system feature) to survive a ./gwan process stop/restrat. Of course, you can also use SQLite (memory based or disk based), see the G-WAN examples. – Gil Mar 21 '13 at 16:38