Application scope

Jul 1, 2011 at 4:10 PM

Implemented a library to manage the application scope data. It's based on the v8cgi session implementation which can be found in the v8cgi lib directory.

The library has been called "application.js", it's available in the "lib" directory of our project and it should be copied in the v8cgi lib directory (where you can find for example also the session.js file).

The library put all the application data in a file on the filesystem, the path and the filename could be configured in the v8cgi.conf file. If you don't configure this two parameter the default values are the two shown below.

// This is the v8cgi.conf file...
// path where put the application data file Config["applicationPath"] = "/tmp"; // file where put the application data Config["applicationFilename"] = "";


Follow and example of its usage:

include("application"); var application = new (require("application").Application)(); if (!application.get("counter")) { application.set("counter", 1); } else { application.set("counter", application.get("counter") +1); } response.write("counter = " + application.get("counter"));


This example has been added also in example/application_counter.sjs.