Nuke Documentation

Structure Image​Pipeline.​Cache

public struct Cache  

Provides a set of convenience APIs for managing the pipeline cache layers, including ImageCaching (memory cache) and DataCaching (disk cache).

Thread-safe.

Member Of

ImagePipeline

ImagePipeline is the primary way to load images directly (without a UI).

Nested Types

ImagePipeline.Cache.Caches

Describes a set of cache layers to use.

Methods

cached​Image(for:​caches:​)

public func cachedImage(for request: ImageRequestConvertible, caches: Caches = [.all]) -> ImageContainer?  

Returns a cached image any of the caches.

Parameters

request Image​Request​Convertible

The request. Make sure to remove the processors if you want to retrieve an original image (if it's stored).

caches Caches

[.all], by default.

store​Cached​Image(_:​for:​caches:​)

public func storeCachedImage(_ image: ImageContainer, for request: ImageRequestConvertible, caches: Caches = [.all])  

Stores the image in all caches. To store image in the disk cache, it will be encoded (see ImageEncoding)

Parameters

request Image​Request​Convertible

The request. Make sure to remove the processors if you want to retrieve an original image (if it's stored).

caches Caches

[.all], by default.

remove​Cached​Image(for:​caches:​)

public func removeCachedImage(for request: ImageRequestConvertible, caches: Caches = [.all])  

Removes the image from all caches.

contains​Cached​Image(for:​caches:​)

public func containsCachedImage(for request: ImageRequestConvertible, caches: Caches = [.all]) -> Bool  

Returns true if any of the caches contain the image.

cached​Data(for:​)

public func cachedData(for request: ImageRequestConvertible) -> Data?  

Returns cached data for the given request.

store​Cached​Data(_:​for:​)

public func storeCachedData(_ data: Data, for request: ImageRequestConvertible)  

Stores data for the given request.

contains​Data(for:​)

public func containsData(for request: ImageRequestConvertible) -> Bool  

Returns true if the data cache contains data for the given image

remove​Cached​Data(for:​)

public func removeCachedData(for request: ImageRequestConvertible)  

Removes cached data for the given request.

make​Image​Cache​Key(for:​)

public func makeImageCacheKey(for request: ImageRequestConvertible) -> ImageCacheKey  

Returns image cache (memory cache) key for the given request.

make​Data​Cache​Key(for:​)

public func makeDataCacheKey(for request: ImageRequestConvertible) -> String  

Returns data cache (disk cache) key for the given request.

remove​All(caches:​)

public func removeAll(caches: Caches = [.all])  

Removes both images and data from all cache layes.