Billhighway Cloud API

<back to all web services

CacheClearRq

The following routes are available for this service:
DELETE/devops/api/caches/{location}
import Foundation
import ServiceStack

public class CacheClearRq : Codable
{
    public var location:String?

    required public init(){}
}

public class CacheClearRs : Codable
{
    public var result:CacheClearResult?
    public var beforeStatistics:CacheStatResult?
    public var afterStatistics:CacheStatResult?

    required public init(){}
}

public class CacheClearResult : CacheResultBase
{
    public var isCleared:Bool?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case isCleared
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        isCleared = try container.decodeIfPresent(Bool.self, forKey: .isCleared)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if isCleared != nil { try container.encode(isCleared, forKey: .isCleared) }
    }
}

public class CacheResultBase : Codable
{
    public var result:CacheResult?
    public var location:CacheLocation?
    public var key:CacheKey?

    required public init(){}
}

// @Flags()
public enum CacheResult : Int, Codable
{
    case None = 0
    case Miss = 1
    case Hit = 2
    case Put = 4
    case Deleted = 8
    case Cleared = 16
    case Added = 32
    case Updated = 64
    case Unavailable = 128
    case Expired = 256
}

public enum CacheLocation : Int, Codable
{
    case None = 0
    case OutOfProcess = 1
    case InProcess = 2
    case InContext = 3
}

public class CacheKey : Codable
{
    public var region:String?
    public var baseKey:String?
    public var key:String?
    public var expirationSeconds:Int?

    required public init(){}
}

public class CacheStatResult : CacheResultBase
{
    public var statistics:[CacheStat] = []
    public var isHit:Bool?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case statistics
        case isHit
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        statistics = try container.decodeIfPresent([CacheStat].self, forKey: .statistics) ?? []
        isHit = try container.decodeIfPresent(Bool.self, forKey: .isHit)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if statistics.count > 0 { try container.encode(statistics, forKey: .statistics) }
        if isHit != nil { try container.encode(isHit, forKey: .isHit) }
    }
}

public class CacheStat : Codable
{
    public var name:String?
    public var value:String?

    required public init(){}
}


Swift CacheClearRq DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

DELETE /devops/api/caches/{location} HTTP/1.1 
Host: devapi.billhighway.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Result":{"IsCleared":false,"Result":0,"Location":0},"BeforeStatistics":{"Statistics":[{"Name":"String","Value":"String"}],"IsHit":false,"Result":0,"Location":0},"AfterStatistics":{"Statistics":[{"Name":"String","Value":"String"}],"IsHit":false,"Result":0,"Location":0}}