code: function _Wrap(key, setFunction, _cacheGetter, _cacheSetter, ttl) {
      return new Promise((resolve, reject) => {
          // attempt to get the requested key (note, no prefix here, it's attached in the Get function)
          //  pass success directly through to resolve
          _cacheGetter.bind(this)(key).then(resolve, () => {
              // if cache miss, call the setFunction to get the new value we want
              setFunction().then((dataToCache) => {
                  // work out ttl
                  var options = {};
                  if (ttl) {
                      //  if it's a function, call the function to get the required ttl
                      if (typeof ttl == "function") {
                          ttl = ttl();
                      }
                      options.ttl = ttl;
                  }
  
                  // store in cache
                  _cacheSetter.bind(this)(key, dataToCache, options).then(() => {
                      // resolve with newly cached data
                      resolve(dataToCache);
                  }, reject);
              }, reject);
          });
      });
  }
docs: Internal wrap helper to not copy/paste logic for global and local-scope wraps