docs: private Result readByRange(int type, int index, int length, boolean checkExpired, boolean filter) {
          final String methodName = "readByRange()";
          Result result = getFromResultPool();
          ValueSet answer = null;
          ValueSet expiredIds = null;
          boolean all = false;
          HashtableOnDisk cache_instance = null;
          try {
              rwLock.readLock().lock();
              if (type == CACHE_ID_DATA) {
                  cache_instance = object_cache;
              } else if (type == DEP_ID_DATA) {
                  cache_instance = dependency_cache;
              } else {
                  cache_instance = template_cache;
              }
              if (cache_instance != null) {
                  if (index < 0) {
                      index = cache_instance.getPreviousRangeIndex();
                  } else if (index > 0) {
                      index = cache_instance.getNextRangeIndex();
                  } else {
                      cache_instance.initRangeIndex();
                  }
                  if (length == -1) {
                      all = true;
                      length = cache_instance.size();
                  }
                  if (length <= 0) {
                      result.data = EMPTY_VS;
                      return result;
                  }
                  if (tc.isDebugEnabled())
                      Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " before range index=" + index + " length=" + length);
                  answer = new ValueSet(length);
                  if (checkExpired) {
                      expiredIds = new ValueSet(length / 2);
                  }
                  ValueSetReadCallback vscr = new ValueSetReadCallback(answer, expiredIds);
                  int rangeIndex = cache_instance.iterateKeys(vscr, index, length);
                  if (checkExpired) {
                      if (tc.isDebugEnabled())
                          Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " after range index=" + rangeIndex + " length=" + length + " idsFound=" + answer.size()
                                                   + " idsExpired=" + expiredIds.size());
                  } else {
                      if (tc.isDebugEnabled())
                          Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " after range index=" + rangeIndex + " length=" + length + " idsFound=" + answer.size());
                  }
                  cache_instance.addRangeIndex(rangeIndex);
                  if (checkExpired) {
                      // add a dummy entry to indicate more entries in the disk cache
                      if (!all && (answer.size() + expiredIds.size()) >= length) {
                          answer.add(DISKCACHE_MORE);
                      }
                  } else {
                      if (!all && answer.size() >= length) {
                          answer.add(DISKCACHE_MORE);
                      }
                  }
                  if (expiredIds != null && expiredIds.size() > 0) {
                      this.invalidationBuffer.add(expiredIds, HTODInvalidationBuffer.SCAN_BUFFER, CachePerf.TIMEOUT, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION,
                                                  HTODInvalidationBuffer.FIRE_EVENT, HTODInvalidationBuffer.CHECK_FULL);
                      if (tc.isDebugEnabled())
                          Tr.debug(tc, methodName, "*** HTOD SCAN: ids found=" + answer.size() + " expired ids=" + expiredIds.size());
                  }
                  if (filter) {
                      this.invalidationBuffer.filter(answer);
                  }
              }
          } catch (FileManagerException ex) {
              this.diskCacheException = ex;
              result.diskException = ex;
              result.returnCode = DISK_EXCEPTION;
          } catch (HashtableOnDiskException ex) {
              this.diskCacheException = ex;
              result.diskException = ex;
              result.returnCode = DISK_EXCEPTION;
          } catch (IOException ex) {
              this.diskCacheException = ex;
              result.diskException = ex;
              result.returnCode = DISK_EXCEPTION;
          } catch (Exception ex) {
              result.returnCode = OTHER_EXCEPTION;
              result.diskException = ex;
          } finally {
              rwLock.readLock().unlock();
              if (result.returnCode != NO_EXCEPTION) {
                  if (tc.isDebugEnabled())
                      Tr.debug(tc, methodName, "cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
              }
              if (result.returnCode == DISK_EXCEPTION || result.returnCode == OTHER_EXCEPTION) {
                  com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.readByRange", "1582", this);
              }
          }
          result.data = answer;
          return result;
      }