}
return keyInfo;
}
protected KeyInfo handleHash(final Jedis jedis) {
final KeyInfo keyInfo = new KeyInfo(this.key, KeyType.HASH);
keyInfo.setSize(jedis.hlen(this.key));
if (this.doArrayValue) {
final List<String> allFields = new ArrayList<String>(jedis.hkeys(this.key));
if (this.offset >= allFields.size()) {
keyInfo.setArrayValue(new ArrayList<String>(1));
} else {
final int toIndex = (this.offset + this.count > allFields.size())
? allFields.size()
: (this.offset + this.count);
final List<String> subFields = allFields.subList(this.offset, toIndex);
final List<String> values = jedis.hmget(this.key,
subFields.toArray(new String[subFields.size()]));
final List<String> arrayValue = new ArrayList<String>(subFields.size());
for (int i = 0; i < subFields.size(); i++) {
arrayValue.add("{" + subFields.get(i) + "=" + values.get(i) + "}");
}
keyInfo.setArrayValue(arrayValue);
}
}
return keyInfo;
}