Advertisement
Advertisement

More Related Content

Slideshows for you(20)

Advertisement
Advertisement

EWD 3 Training Course Part 27: The QEWD Session

  1. Copyright © 2016 M/Gateway Developments Ltd EWD 3 Training Course Part 27 JavaScript Abstraction of Global Storage: The QEWD Session Rob Tweed Director, M/Gateway Developments Ltd Twitter: @rtweed
  2. Copyright © 2016 M/Gateway Developments Ltd The QEWD Session • Ephemeral storage that persists as long as a user remains active • Controlled / managed by the ewd-session module – This has a dependency on the ewd-document-store module
  3. Copyright © 2016 M/Gateway Developments Ltd The QEWD Session • The Session object contains some information that is maintained by ewd-session itself – Used behind the scenes by QEWD • session.data is available to the developer for storage and retrieval of application- specific session information
  4. Copyright © 2016 M/Gateway Developments Ltd The QEWD Session • Session data is automatically garbage- collected after the session expires
  5. Copyright © 2016 M/Gateway Developments Ltd Accessing the Session in QEWD • Automatically made available to your back-end message handler functions myHandler: function(messageObj, session, send, finished) {…};
  6. Copyright © 2016 M/Gateway Developments Ltd session.data is a DocumentNode Object • session.data is an automatically-generated DocumentNode object – Points to the Session global storage for the user whose message you're processing – The developer can access and manipulate the session.data contents by using the standard DocumentNode APIs
  7. Copyright © 2016 M/Gateway Developments Ltd Accessing the Session in QEWD myHandler: function(messageObj, session, send, finished) {..}; For example: - session.data.$('mySessionVariable').value = 'bar'; - var foo = session.data.$('mySessionVariable').value; - var someObj = session.data.$('mySessionObj').getDocument(); - session.data.$('mySessionObj').setDocument(someObj);
  8. Copyright © 2016 M/Gateway Developments Ltd Underlying Global Storage? • By default it maps to a Global named – CacheTempEWDSession – On a Caché system, any Global prefixed CacheTemp is mapped to in-memory storage and isn't journalled • Highest performance • You can over-ride this and define your own Global name – In the QEWD startup file • config.sessionDocumentName
  9. Copyright © 2016 M/Gateway Developments Ltd QEWD startup file example var config = { managementPassword: 'keepThisSecret!', serverName: 'New QEWD Server', port: 8080, poolSize: 1, database: { type: 'cache', params: { path: 'c:InterSystemsCache2015-2mgr’ }, sessionDocumentName: 'mySessionGlobal' }}; var qewd = require('qewd').master; qewd.start(config);
Advertisement