protected int getKeyCount(KeySpan keySpan) {
		if (keySpan.isEmpty()) {
			return 0;
		}
		int i = 0;
		try (LockHold hold = LockHold.lock(lock.readLock())) {
			if (KeySpan.ALL.equals(keySpan)) {
				throw new AssertionError();
			}
			DirectedLongKeyIterator it =
				DirectedLongKeyIterator.getIterator(table, keySpan, Direction.FORWARD);
			while (it.hasNext()) {
				it.next();
				i++;
			}
		}
		catch (IOException e) {
			adapter.dbError(e);
		}
		return i;
	}
Count the number of keys in a given range.

<p>
This implementation is not very efficient. It must visit at least every record in the range.

@param keySpan the range of keys
@return the count of records whose keys fall within the range
Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBCachedObjectStore.java