### Method

# Vips Image linecache

#### Declaration [src]

    int
    vips_linecache (
      VipsImage* in,
      VipsImage** out,
      ...
    )

#### Description [src]

This operation behaves rather like `vips_copy()` between images `in` and `out`, except that it keeps a cache of computed scanlines.

The number of lines cached is enough for a small amount of non-local access.

Each cache tile is made with a single call to `vips_region_prepare()`.

When the cache fills, a tile is chosen for reuse. If `access` is `VIPS_ACCESS_RANDOM`, then the least-recently-used tile is reused. If `access` is `VIPS_ACCESS_SEQUENTIAL`, then the top-most tile is reused. `access` defaults to `VIPS_ACCESS_RANDOM`.

`tile_height` can be used to set the size of the strips that `vips_linecache()` uses. The default is 1 (a single scanline).

Normally, only a single thread at once is allowed to calculate tiles. If you set `threaded` to `TRUE`, `vips_linecache()` will allow many threads to calculate tiles at once and share the cache between them.

Optional arguments

- `access`: `VipsAccess`, hint expected access pattern
- `tile_height`: `gint`, height of tiles in cache
- `threaded`: `gboolean`, allow many threads

See also

`vips_tilecache()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `VipsImage`

  Output image.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.