Backend
public class Backend<T> where T : DataTransformable
Represents a storage back-end for the DiskStorage
. The value is serialized to data
and stored as file in the file system under a specified location.
You can config a DiskStorage.Backend
in its initializer by passing a DiskStorage.Config
value.
or modifying the config
property after it being created. DiskStorage
will use file’s attributes to keep
track of a file for its expiration or size limitation.
-
The config used for this disk storage.
Declaration
Swift
public var config: Config
-
Undocumented
Declaration
Swift
public let directoryURL: URL
-
Creates a disk storage with the given
DiskStorage.Config
.Throws
An error if the folder for storage cannot be got or created.Declaration
Swift
public init(config: Config) throws
Parameters
config
The config used for this disk storage.
-
The URL of the cached file with a given computed
key
.Note
This method does not guarantee there is an image already cached in the returned URL. It just gives your the URL that the image should be if it exists in disk storage, with the give key.
Declaration
Swift
public func cacheFileURL(forKey key: String) -> URL
Parameters
key
The final computed key used when caching the image. Please note that usually this is not the
cacheKey
of an imageSource
. It is the computed key with processor identifier considered.