# PrefetchScheduler

# PrefetchScheduler

Artifact:[androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation)  
[View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/lazy/layout/PrefetchScheduler.kt+class:androidx.compose.foundation.lazy.layout.PrefetchScheduler)  
Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)  
Deprecated in[1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)
Common/AllAndroid/JVM
  - Cmn  

  ```
  @ExperimentalFoundationApi
  interface PrefetchScheduler
  ```

*** ** * ** ***

| **This interface is deprecated.**   
| Customization of PrefetchScheduler is no longer supported. LazyLayout will attach an appropriate scheduler internally. If you needed to customize it please file a Feature Request.

Implementations of this interface accept prefetch requests via[schedulePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchScheduler#schedulePrefetch(androidx.compose.foundation.lazy.layout.PrefetchRequest))and decide when to execute them in a way that will have minimal impact on user experience, e.g. during frame idle time.

Requests should be executed by invoking[PrefetchRequest.execute](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchRequest#(androidx.compose.foundation.lazy.layout.PrefetchRequestScope).execute()). The implementation of[PrefetchRequest.execute](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchRequest#(androidx.compose.foundation.lazy.layout.PrefetchRequestScope).execute())will return`false`when all work for that request is done, or`true`when it still has more to do but doesn't think it can complete it within[PrefetchRequestScope.availableTimeNanos](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchRequestScope#availableTimeNanos()).

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [schedulePrefetch](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchScheduler#schedulePrefetch(androidx.compose.foundation.lazy.layout.PrefetchRequest))`(prefetchRequest: `[PrefetchRequest](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchRequest)`)` Accepts a prefetch request. | Cmn |

## Public functions

### schedulePrefetch

Cmn  
Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)  
Deprecated in[1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)  

```
fun schedulePrefetch(prefetchRequest: PrefetchRequest): Unit
```

Accepts a prefetch request. Implementations should find a time to execute them which will have minimal impact on user experience.