How to use the node-persist.removeItemSync function in node-persist

To help you get started, we’ve selected a few node-persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleChromeLabs / web-push-testing-service / src / cli / index.js View on Github external
process.exit(1);
      return;
    }

    const servicePID = storage.getItemSync(serviceName);
    let serviceStopped = false;
    if (servicePID !== null) {
      try {
        execSync(`kill -9 ${servicePID} > /dev/null 2>&1`);
        serviceStopped = true;
      } catch (err) {
        // NOOP
      }
    }

    storage.removeItemSync(serviceName);

    return serviceStopped;
  }
github GoogleChromeLabs / web-push-testing-service / src / cli.js View on Github external
const stopService = serviceId => {
  const servicePID = storage.getItemSync(serviceId);
  if (servicePID !== null) {
    try {
      execSync(`kill -9 ${servicePID} > /dev/null 2>&1`);
    } catch (err) {
      // NOOP
    }
  }
  storage.removeItemSync(serviceId);
};
github giangvo / alfred-workflow-nodejs / alfredNode.js View on Github external
get: function(key) {
            var obj = storage.getItemSync(key);
            if (obj) {
                var ttl = obj.ttl;
                var timestamp = obj.timestamp;
                // if not ttl => return obj
                if (ttl === -1) {
                    return obj.data;
                } else {
                    // check ttl
                    var now = new Date().getTime();
                    if (now - timestamp < ttl) {
                        return obj.data;
                    } else {
                        storage.removeItemSync(key, function() {});
                    }
                }
            }
        },
github KhaosT / HAP-NodeJS / src / lib / model / AccessoryInfo.ts View on Github external
remove = () => {
    var key = AccessoryInfo.persistKey(this.username);

    storage.removeItemSync(key);
  }
github originallyus / node-red-contrib-alexa-local / index.js View on Github external
function clearLightStateForLightId(lightId) 
    {
        if (storage === null || storage === undefined) {
            RED.log.warn("storage is null in clearLightStateForLightId");
            return;
        }
        if (lightId === null || lightId === undefined) {
            RED.log.warn("lightId is null");
            return null;
        }

        var key = formatUUID(lightId) + "_state";
        storage.removeItemSync(key);
    }
}
github KhaosT / HAP-NodeJS / src / lib / model / IdentifierCache.ts View on Github external
remove = () =>  {
    var key = IdentifierCache.persistKey(this.username);
    storage.removeItemSync(key);
  }