function deleteSampleKeys(associationType, name) {
  let cmds = [];

  // Sample master list key. e.g.: samsto:samples
  const indexName = redisStore.constants.indexKey[sampleType];

  /* Association key. e.g: samsto:subaspmap:northamerica.unitedstates
  where associationType=subaspmap */
  const assocName = redisStore.toKey(associationType, name);

  // e.g samsto:sample:
  const sampleKeyPrefix = redisStore.constants.prefix +
   redisStore.constants.separator + sampleType + redisStore.constants.separator;
  const keyArr = [];
  let deletedSamples = [];
  return redisClient.smembersAsync(assocName)
  .then((members) => {
    members.forEach((member) => {
      let sampleKey = sampleKeyPrefix;

      if (associationType === subAspMapType) {
        // name is subject absolute path and member is an aspect name
        sampleKey = sampleKey + name.toLowerCase() + '|' + member;
      } else if (associationType === aspSubMapType) {
        // name is aspect name and member is subject absolute path
        sampleKey = sampleKey + member + '|' + name.toLowerCase();
      }

      // sampleKey e.g: samsto:sample:northamerica.unitedstates|toohot
      keyArr.push(sampleKey);
      cmds.push(['hgetall', sampleKey]);
    });

    return redisClient.batch(cmds).execAsync();
  })
  .then((samples) => {
    deletedSamples = samples || [];

    /*
     * Delete all the sample hashes and remove the entries from the master
     * index of samples.
     */
    const delCmds = keyArr.map((key) => ['del', key]);
    const sremCmds = keyArr.map((key) => ['srem', indexName, key]);
    return executeBatchCmds(delCmds.concat(sremCmds));
  })
  .then(() => deletedSamples);
} // deleteSampleKeys
/**
 * Deletes the samples associated with the passed in association type.
 * @param  {String} associationType - Association type, using which the lookup
 * needs to be done.
 * @param  {String} name  - Name of the object whose related samples are to be
 * deleted.
 * @returns {Array} of deleted sample
 */
Deletes the samples associated with the passed in association type.
@param  {String} associationType - Association type, using which the lookup
needs to be done.
@param  {String} name  - Name of the object whose related samples are to be
deleted.
@returns {Array} of deleted sample
Deletes the samples associated with the passed in association type . @param { String } associationType - Association type using which the lookup needs to be done . @param { String } name - Name of the object whose related samples are to be deleted . @returns { Array } of deleted sample
function deleteSampleKeys(associationType, name) {
  let cmds = [];
  const indexName = redisStore.constants.indexKey[sampleType];
  const assocName = redisStore.toKey(associationType, name);
  const sampleKeyPrefix = redisStore.constants.prefix +
   redisStore.constants.separator + sampleType + redisStore.constants.separator;
  const keyArr = [];
  let deletedSamples = [];
  return redisClient.smembersAsync(assocName)
  .then((members) => {
    members.forEach((member) => {
      let sampleKey = sampleKeyPrefix;
      if (associationType === subAspMapType) {
        sampleKey = sampleKey + name.toLowerCase() + '|' + member;
      } else if (associationType === aspSubMapType) {
        sampleKey = sampleKey + member + '|' + name.toLowerCase();
      }
      keyArr.push(sampleKey);
      cmds.push(['hgetall', sampleKey]);
    });
    return redisClient.batch(cmds).execAsync();
  })
  .then((samples) => {
    deletedSamples = samples || [];
    const delCmds = keyArr.map((key) => ['del', key]);
    const sremCmds = keyArr.map((key) => ['srem', indexName, key]);
    return executeBatchCmds(delCmds.concat(sremCmds));
  })
  .then(() => deletedSamples);
} 
function deleteSampleKeys ( associationType , name ) { let cmds = [ ] ; const indexName = redisStore . constants . indexKey [ sampleType ] ; const assocName = redisStore . toKey ( associationType , name ) ; const sampleKeyPrefix = redisStore . constants . prefix + redisStore . constants . separator + sampleType + redisStore . constants . separator ; const keyArr = [ ] ; let deletedSamples = [ ] ; return redisClient . smembersAsync ( assocName ) . then ( ( members ) => { members . forEach ( ( member ) => { let sampleKey = sampleKeyPrefix ; if ( associationType === subAspMapType ) { sampleKey = sampleKey + name . toLowerCase ( ) + '|' + member ; } else if ( associationType === aspSubMapType ) { sampleKey = sampleKey + member + '|' + name . toLowerCase ( ) ; } keyArr . push ( sampleKey ) ; cmds . push ( [ 'hgetall' , sampleKey ] ) ; } ) ; return redisClient . batch ( cmds ) . execAsync ( ) ; } ) . then ( ( samples ) => { deletedSamples = samples || [ ] ; const delCmds = keyArr . map ( ( key ) => [ 'del' , key ] ) ; const sremCmds = keyArr . map ( ( key ) => [ 'srem' , indexName , key ] ) ; return executeBatchCmds ( delCmds . concat ( sremCmds ) ) ; } ) . then ( ( ) => deletedSamples ) ; }
Deletes the samples associated with the passed in association type.
Deletes the samples associated with the passed in association type .
// Sample master list key. e.g.: samsto:samples /* Association key. e.g: samsto:subaspmap:northamerica.unitedstates
  where associationType=subaspmap */ // e.g samsto:sample: // name is subject absolute path and member is an aspect name // name is aspect name and member is subject absolute path // sampleKey e.g: samsto:sample:northamerica.unitedstates|toohot /*
     * Delete all the sample hashes and remove the entries from the master
     * index of samples.
     */ // deleteSampleKeys