Kingfisher Documentation

Structure Disk​Storage.​Config

public struct Config  

Represents the config used in a DiskStorage.

Member Of


Represents a set of conception related to storage which stores a certain type of value in disk. This is a namespace for the disk storage types. A Backend with a certain Config will be used to describe the storage. See these composed types for more information.



public init(
            name: String,
            sizeLimit: UInt,
            fileManager: FileManager = .default,
            directory: URL? = nil) 

Creates a config value based on given parameters.


name String

The name of cache. It is used as a part of storage folder. It is used to identify the disk storage. Two storages with the same name would share the same folder in disk, and it should be prevented.

size​Limit UInt

The size limit in bytes for all existing files in the disk storage.

file​Manager File​Manager

The FileManager used to manipulate files on disk. Default is FileManager.default.

directory URL?

The URL where the disk storage should live. The storage will use this as the root folder, and append a path which is constructed by input name. Default is nil, indicates that the cache directory under user domain mask will be used.



public var sizeLimit: UInt

The file size limit on disk of the storage in bytes. 0 means no limit.


public var expiration: StorageExpiration  

The StorageExpiration used in this disk storage. Default is .days(7), means that the disk cache would expire in one week.


public var pathExtension: String? = nil

The preferred extension of cache item. It will be appended to the file name as its extension. Default is nil, means that the cache file does not contain a file extension.


public var usesHashedFileName = true

Default is true, means that the cache file name will be hashed before storing.


public var autoExtAfterHashedFileName = false

Default is false If set to true, image extension will be extracted from original file name and append to the hased file name and used as the cache key on disk.