RequestCache

open class RequestCache : RequestCacheProtocol, @unchecked Sendable

默认请求文件缓存

  • Undocumented

    Declaration

    Swift

    public static let `default`: RequestCache
  • 请求缓存路径过滤句柄,返回处理后的路径

    Declaration

    Swift

    open var cacheFilePathFilter: (@Sendable (_ request: HTTPRequest, _ filePath: String) -> String)?
  • 请求缓存文件名过滤器,返回处理后的文件名

    Declaration

    Swift

    open var cacheFileNameFilter: (@Sendable (_ request: HTTPRequest, _ fileName: String) -> String)?
  • Undocumented

    Declaration

    Swift

    public init()
  • 获取请求缓存基础路径

    Declaration

    Swift

    open func cacheFilePath(for request: HTTPRequest) -> String
  • 获取请求缓存文件名

    Declaration

    Swift

    open func cacheFileName(for request: HTTPRequest) -> String
  • Undocumented

    Declaration

    Swift

    open func loadCache(for request: HTTPRequest) throws -> (data: Data, metadata: Data)
  • Undocumented

    Declaration

    Swift

    open func saveCache(_ cache: (data: Data, metadata: Data), for request: HTTPRequest) throws
  • Undocumented

    Declaration

    Swift

    open func clearCache(for request: HTTPRequest) throws