text: const rootPrefix = '../../..',
    CacheMultiBase = require(rootPrefix + '/lib/cacheManagement/multi/Base'),
    ReplyDetailsModel = require(rootPrefix + '/app/models/mysql/ReplyDetail'),
    responseHelper = require(rootPrefix + '/lib/formatter/response'),
    cacheManagementConstants = require(rootPrefix + '/lib/globalConstant/cacheManagement');
  
  /**
   * Class for reply details by ids cache.
   *
   * @class ReplyDetailsByIdsCache
   */
  class ReplyDetailsByIdsCache extends CacheMultiBase {
    /**
     * Init params in oThis.
     *
     * @param {object} params
     * @param {array<number>} params.ids
     *
     * @sets oThis.ids
     *
     * @private
     */
    _initParams(params) {
      const oThis = this;
  
      oThis.ids = params.ids;
    }
  
    /**
     * Set cache type.
     *
     * @sets oThis.cacheType
     *
     * @private
     */
    _setCacheType() {
      const oThis = this;
  
      oThis.cacheType = cacheManagementConstants.memcached;
    }
  
    /**
     * Set cache keys.
     *
     * @sets oThis.cacheKeys
     *
     * @private
     */
    _setCacheKeys() {
      const oThis = this;
  
      for (let ind = 0; ind < oThis.ids.length; ind++) {
        oThis.cacheKeys[oThis._cacheKeyPrefix() + '_cmm_rd_rid_' + oThis.ids[ind]] = oThis.ids[ind];
      }
    }
  
    /**
     * Set cache expiry in oThis.cacheExpiry.
     *
     * @sets oThis.cacheExpiry
     *
     * @private
     */
    _setCacheExpiry() {
      const oThis = this;
      oThis.cacheExpiry = cacheManagementConstants.largeExpiryTimeInterval; // 24 hours ;
    }
  
    /**
     * Fetch data from source for cache miss ids
     *
     * @param cacheMissIds
     *
     * @return {Promise<*>}
     */
    async fetchDataFromSource(cacheMissIds) {
      const fetchByIdsRsp = await new ReplyDetailsModel().fetchByIds(cacheMissIds);
  
      return responseHelper.successWithData(fetchByIdsRsp);
    }
  }
  
  module.exports = ReplyDetailsByIdsCache;
  