Config

public struct Config

Represents the config used in a MemoryStorage.

  • Total cost limit of the storage in bytes.

    Declaration

    Swift

    public var totalCostLimit: Int
  • The item count limit of the memory storage.

    Declaration

    Swift

    public var countLimit: Int
  • The StorageExpiration used in this memory storage. Default is .seconds(300), means that the memory cache would expire in 5 minutes.

    Declaration

    Swift

    public var expiration: StorageExpiration
  • The time interval between the storage do clean work for swiping expired items.

    Declaration

    Swift

    public let cleanInterval: TimeInterval
  • Creates a config from a given totalCostLimit value.

    Note

    Other members of MemoryStorage.Config will use their default values when created.

    Declaration

    Swift

    public init(totalCostLimit: Int, cleanInterval: TimeInterval = 120)

    Parameters

    totalCostLimit

    Total cost limit of the storage in bytes.

    cleanInterval

    The time interval between the storage do clean work for swiping expired items. Default is 120, means the auto eviction happens once per two minutes.