lib/runner.js
function ScriptRunner() {
  this.flush();

  function onMessage(msg, handle) {
    var script, digest;
    switch(msg.event) {
      case 'loglevel':
        log.level(msg.level);
        break;
      case 'eval':
        try {
          script = this.load(msg.source).script;
          this.run(script, msg.args);
        }catch(e) {
          process.send({err: true, data: e.message});
        }
        break;
      case 'evalsha':
        try {
          script = this._cache[msg.sha];
          if(!script) throw NoScript;
          this.run(script, msg.args);
        }catch(e) {
          process.send({err: true, data: e.message});
        }
        break;
      case 'load':
        try {
          digest = this.load(msg.source).sha;
          process.send({data: digest});
        }catch(e) {
          process.send({err: true, data: e.message});
        }
        break;
      case 'exists':
        process.send({data: this.exists(msg.args)});
        break;
      case 'flush':
        this.flush();
        process.send({data: Constants.OK});
        break;
    }
  }

  process.on('message', onMessage.bind(this));
}
function ScriptRunner() {
  this.flush();

  function onMessage(msg, handle) {
    var script, digest;
    switch(msg.event) {
      case 'loglevel':
        log.level(msg.level);
        break;
      case 'eval':
        try {
          script = this.load(msg.source).script;
          this.run(script, msg.args);
        }catch(e) {
          process.send({err: true, data: e.message});
        }
        break;
      case 'evalsha':
        try {
          script = this._cache[msg.sha];
          if(!script) throw NoScript;
          this.run(script, msg.args);
        }catch(e) {
          process.send({err: true, data: e.message});
        }
        break;
      case 'load':
        try {
          digest = this.load(msg.source).sha;
          process.send({data: digest});
        }catch(e) {
          process.send({err: true, data: e.message});
        }
        break;
      case 'exists':
        process.send({data: this.exists(msg.args)});
        break;
      case 'flush':
        this.flush();
        process.send({data: Constants.OK});
        break;
    }
  }

  process.on('message', onMessage.bind(this));
}
function ScriptRunner ( ) { this . flush ( ) ; function onMessage ( msg , handle ) { var script , digest ; switch ( msg . event ) { case 'loglevel' : log . level ( msg . level ) ; break ; case 'eval' : try { script = this . load ( msg . source ) . script ; this . run ( script , msg . args ) ; } catch ( e ) { process . send ( { err : true , data : e . message } ) ; } break ; case 'evalsha' : try { script = this . _cache [ msg . sha ] ; if ( ! script ) throw NoScript ; this . run ( script , msg . args ) ; } catch ( e ) { process . send ( { err : true , data : e . message } ) ; } break ; case 'load' : try { digest = this . load ( msg . source ) . sha ; process . send ( { data : digest } ) ; } catch ( e ) { process . send ( { err : true , data : e . message } ) ; } break ; case 'exists' : process . send ( { data : this . exists ( msg . args ) } ) ; break ; case 'flush' : this . flush ( ) ; process . send ( { data : Constants . OK } ) ; break ; } } process . on ( 'message' , onMessage . bind ( this ) ) ; }
Encapsulates script cache, compilation and execution.
Encapsulates script cache compilation and execution .