# Smart Tiered Cache ## Get Smart Tiered Cache setting `client.Cache.SmartTieredCache.Get(ctx, query) (*SmartTieredCacheGetResponse, error)` **get** `/zones/{zone_id}/cache/tiered_cache_smart_topology_enable` Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin. ### Parameters - `query SmartTieredCacheGetParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type SmartTieredCacheGetResponse struct{…}` - `ID SmartTieredCacheGetResponseID` The identifier of the caching setting. - `const SmartTieredCacheGetResponseIDTieredCacheSmartTopologyEnable SmartTieredCacheGetResponseID = "tiered_cache_smart_topology_enable"` - `Editable bool` Whether the setting is editable. - `Value SmartTieredCacheGetResponseValue` Value of the Smart Tiered Cache zone setting. - `const SmartTieredCacheGetResponseValueOn SmartTieredCacheGetResponseValue = "on"` - `const SmartTieredCacheGetResponseValueOff SmartTieredCacheGetResponseValue = "off"` - `ModifiedOn Time` Last time this setting was modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cache" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) smartTieredCache, err := client.Cache.SmartTieredCache.Get(context.TODO(), cache.SmartTieredCacheGetParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", smartTieredCache.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tiered_cache_smart_topology_enable", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Patch Smart Tiered Cache setting `client.Cache.SmartTieredCache.Edit(ctx, params) (*SmartTieredCacheEditResponse, error)` **patch** `/zones/{zone_id}/cache/tiered_cache_smart_topology_enable` Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin. ### Parameters - `params SmartTieredCacheEditParams` - `ZoneID param.Field[string]` Path param: Identifier. - `Value param.Field[SmartTieredCacheEditParamsValue]` Body param: Enable or disable the Smart Tiered Cache. - `const SmartTieredCacheEditParamsValueOn SmartTieredCacheEditParamsValue = "on"` - `const SmartTieredCacheEditParamsValueOff SmartTieredCacheEditParamsValue = "off"` ### Returns - `type SmartTieredCacheEditResponse struct{…}` - `ID SmartTieredCacheEditResponseID` The identifier of the caching setting. - `const SmartTieredCacheEditResponseIDTieredCacheSmartTopologyEnable SmartTieredCacheEditResponseID = "tiered_cache_smart_topology_enable"` - `Editable bool` Whether the setting is editable. - `Value SmartTieredCacheEditResponseValue` Value of the Smart Tiered Cache zone setting. - `const SmartTieredCacheEditResponseValueOn SmartTieredCacheEditResponseValue = "on"` - `const SmartTieredCacheEditResponseValueOff SmartTieredCacheEditResponseValue = "off"` - `ModifiedOn Time` Last time this setting was modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cache" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) response, err := client.Cache.SmartTieredCache.Edit(context.TODO(), cache.SmartTieredCacheEditParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Value: cloudflare.F(cache.SmartTieredCacheEditParamsValueOn), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tiered_cache_smart_topology_enable", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete Smart Tiered Cache setting `client.Cache.SmartTieredCache.Delete(ctx, body) (*SmartTieredCacheDeleteResponse, error)` **delete** `/zones/{zone_id}/cache/tiered_cache_smart_topology_enable` Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin. ### Parameters - `body SmartTieredCacheDeleteParams` - `ZoneID param.Field[string]` Identifier. ### Returns - `type SmartTieredCacheDeleteResponse struct{…}` - `ID SmartTieredCacheDeleteResponseID` The identifier of the caching setting. - `const SmartTieredCacheDeleteResponseIDTieredCacheSmartTopologyEnable SmartTieredCacheDeleteResponseID = "tiered_cache_smart_topology_enable"` - `Editable bool` Whether the setting is editable. - `ModifiedOn Time` Last time this setting was modified. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/cache" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) smartTieredCache, err := client.Cache.SmartTieredCache.Delete(context.TODO(), cache.SmartTieredCacheDeleteParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", smartTieredCache.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tiered_cache_smart_topology_enable", "editable": true, "modified_on": "2014-01-01T05:20:00.12345Z" } } ```