Prefetching based on access pattern detection