INNER CODE UNIT · JavaScript

EvalCache

SoftInstigate/restheart · polyglot/src/js/restheart.js:18

class EvalCache {
    constructor(minutesToLive = 10) {
      this.millisecondsToLive = minutesToLive * 60 * 1000;
      this.cache = new Map();
      this.get = this.get.bind(this);
      this.put = this.put.bind(this);
      this.gc = this.gc.bind(this);
      this.fetchDate = new Date(0);
    }

    isCacheExpired() {
      return (this.fetchDate.getTime() + this.millisecondsToLive) < new Date().getTime();
    }

    get(codeHash) {
      if (!this.cache.has(codeHash)) {
        return null;
      } else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…