Unverified Commit 89d912c6 authored by John Crepezzi's avatar John Crepezzi Committed by GitHub
Browse files

Merge pull request #347 from seejohnrun/fix-memcached

Fix memcached client fetch for key not found
parents f3b0de74 4cac6713
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class MemcachedDocumentStore {

  // Save file in a key
  set(key, data, callback, skipExpire) {
    this.client.set(key, data, skipExpire ? 0 : this.expire, (error) => {
    this.client.set(key, data, skipExpire ? 0 : this.expire || 0, (error) => {
      callback(!error);
    });
  }
@@ -34,10 +34,12 @@ class MemcachedDocumentStore {
  // Get a file from a key
  get(key, callback, skipExpire) {
    this.client.get(key, (error, data) => {
      callback(error ? false : data);
      const value = error ? false : data;

      callback(value);

      // Update the key so that the expiration is pushed forward
      if (!skipExpire) {
      if (value && !skipExpire) {
        this.set(key, data, (updateSucceeded) => {
          if (!updateSucceeded) {
            winston.error('failed to update expiration on GET', {key});