Vips.Image.tilecache

### Method

# Vips Imagetilecache

#### Declaration [src]

    int
    vips_tilecache (
      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 pixels. This cache is made of up to `max_tiles` tiles (a value of -1 means any number of tiles), and each tile is of size `tile_width` by `tile_height` pixels.

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` the top-most tile is reused.

By default, `tile_width` and `tile_height` are 128 pixels, and the operation will cache up to 1,000 tiles. `access` defaults to `VIPS_ACCESS_RANDOM`.

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

Normally the cache is dropped when computation finishes. Set `persistent` to `TRUE` to keep the cache between computations.

Optional arguments

- `tile_width`: `gint`, width of tiles in cache
- `tile_height`: `gint`, height of tiles in cache
- `max_tiles`: `gint`, maximum number of tiles to cache
- `access`: `VipsAccess`, hint expected access pattern
- `threaded`: `gboolean`, allow many threads
- `persistent`: `gboolean`, don’t drop cache at end of computation

See also

`vips_linecache()`.

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.