# LazyLayoutCacheWindow

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/LazyLayoutCacheWindow.kt+class:androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface LazyLayoutCacheWindow
  ```

*** ** * ** ***

Represents an out of viewport area of a Lazy Layout where items should be cached. Items will be prepared in the Lazy Layout Cache Window area in advance to improve scroll performance.

## Summary

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow#(androidx.compose.ui.unit.Density).calculateAheadWindow(kotlin.Int)(viewport: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Calculates the prefetch window area in pixels for prefetching on the scroll direction, "ahead window". | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow#(androidx.compose.ui.unit.Density).calculateBehindWindow(kotlin.Int)(viewport: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Calculates the window area in pixels for keeping items in the scroll counter direction, "behind window". | Cmn |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow#isNonScrollCachingEnabled()` Determines whether the cache window populates after a non-scroll related trigger. | Cmn |

## Public functions

### Density.calculateAheadWindow

Cmn 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/LazyLayoutCacheWindow.kt+function:calculateAheadWindow) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
open fun Density.calculateAheadWindow(viewport: Int): Int
```

Calculates the prefetch window area in pixels for prefetching on the scroll direction, "ahead window". The prefetch window strategy will prepare items in the ahead area in advance so they are ready to be used when they become visible.

| Parameters |
|---|---|
| `viewport: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of the viewport in this Lazy Layout in pixels. |

### Density.calculateBehindWindow

Cmn 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/LazyLayoutCacheWindow.kt+function:calculateBehindWindow) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
open fun Density.calculateBehindWindow(viewport: Int): Int
```

Calculates the window area in pixels for keeping items in the scroll counter direction, "behind window". Items in the behind window will not be disposed and can be accessed more quickly if they become visible again.

| Parameters |
|---|---|
| `viewport: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The size of the viewport in this Lazy Layout in pixels. |

## Public properties

### isNonScrollCachingEnabled

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

```
open val isNonScrollCachingEnabled: Boolean
```

Determines whether the cache window populates after a non-scroll related trigger. When set to `true`, the cache window will use non-scroll triggers to start the caching process. For example, if layout data changes and causes a cache purge, the ahead window will be refilled while the layout remains idle. Other common scenarios in which the ahead window fills include initial composition and item reordering, during which the layout is in a non-scroll state, providing the opportunity to populate the window.

Note: Default cache windows for lazy layouts set this to `false`.