docs: function(lockKey, asyncFunction) {
  
            var deferred = $q.defer();
  
            // If the memory lock is set, error out.
            if (memoryLocks[lockKey]) {
              deferred.reject('in_progress');
              return deferred.promise;
            }
  
            // If there is a stored lock but no memory lock, flag a persistence error
            if (persistenceStrategy.get(lockKey) === 'locked') {
              deferred.reject('last_call_interrupted');
              deferred.promise.then(null, function() {
                persistenceStrategy.remove(lockKey);
              });
              return deferred.promise;
            }
  
            // Set stored and memory locks
            memoryLocks[lockKey] = true;
            persistenceStrategy.set(lockKey, 'locked');
  
            // Perform the async operation
            asyncFunction().then(function(successData) {
              deferred.resolve(successData);
  
              // Remove stored and memory locks
              delete memoryLocks[lockKey];
              persistenceStrategy.remove(lockKey);
            }, function(errorData) {
              deferred.reject(errorData);
  
              // Remove stored and memory locks
              delete memoryLocks[lockKey];
              persistenceStrategy.remove(lockKey);
            }, function(notifyData) {
              deferred.notify(notifyData);
            });
  
            return deferred.promise;
          }