Skip to content

Latest commit

 

History

History
229 lines (170 loc) · 7.31 KB

CacheSettingsApi.md

File metadata and controls

229 lines (170 loc) · 7.31 KB

Fastly.CacheSettingsApi

const apiInstance = new Fastly.CacheSettingsApi();

Methods

Method Fastly API endpoint Description
createCacheSettings POST /service/{service_id}/version/{version_id}/cache_settings Create a cache settings object
deleteCacheSettings DELETE /service/{service_id}/version/{version_id}/cache_settings/{cache_settings_name} Delete a cache settings object
getCacheSettings GET /service/{service_id}/version/{version_id}/cache_settings/{cache_settings_name} Get a cache settings object
listCacheSettings GET /service/{service_id}/version/{version_id}/cache_settings List cache settings objects
updateCacheSettings PUT /service/{service_id}/version/{version_id}/cache_settings/{cache_settings_name} Update a cache settings object

createCacheSettings

createCacheSettings({ service_id, version_id, [action, ][cache_condition, ][name, ][stale_ttl, ][ttl] })

Create a cache settings object.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  action: "pass",
  cache_condition: "cache_condition_example",
  name: "name_example",
  stale_ttl: 56,
  ttl: 56,
};

apiInstance.createCacheSettings(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
action String If set, will cause vcl_fetch to terminate after processing this rule with the return state specified. If not set, other configuration logic in vcl_fetch with a lower priority will run after this rule. [optional] [one of: "pass", "deliver", "restart"]
cache_condition String Name of the cache condition controlling when this configuration applies. [optional]
name String Name for the cache settings object. [optional]
stale_ttl Number Maximum time in seconds to continue to use a stale version of the object if future requests to your backend server fail (also known as 'stale if error'). [optional]
ttl Number Maximum time to consider the object fresh in the cache (the cache 'time to live'). [optional]

Return type

CacheSettingResponse

deleteCacheSettings

deleteCacheSettings({ service_id, version_id, cache_settings_name })

Delete a specific cache settings object.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  cache_settings_name: "cache_settings_name_example", // required
};

apiInstance.deleteCacheSettings(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
cache_settings_name String Name for the cache settings object.

Return type

InlineResponse200

getCacheSettings

getCacheSettings({ service_id, version_id, cache_settings_name })

Get a specific cache settings object.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  cache_settings_name: "cache_settings_name_example", // required
};

apiInstance.getCacheSettings(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
cache_settings_name String Name for the cache settings object.

Return type

CacheSettingResponse

listCacheSettings

listCacheSettings({ service_id, version_id })

Get a list of all cache settings for a particular service and version.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
};

apiInstance.listCacheSettings(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.

Return type

[CacheSettingResponse]

updateCacheSettings

updateCacheSettings({ service_id, version_id, cache_settings_name, [action, ][cache_condition, ][name, ][stale_ttl, ][ttl] })

Update a specific cache settings object.

Example

const options = {
  service_id: "service_id_example", // required
  version_id: 56, // required
  cache_settings_name: "cache_settings_name_example", // required
  action: "pass",
  cache_condition: "cache_condition_example",
  name: "name_example",
  stale_ttl: 56,
  ttl: 56,
};

apiInstance.updateCacheSettings(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
service_id String Alphanumeric string identifying the service.
version_id Number Integer identifying a service version.
cache_settings_name String Name for the cache settings object.
action String If set, will cause vcl_fetch to terminate after processing this rule with the return state specified. If not set, other configuration logic in vcl_fetch with a lower priority will run after this rule. [optional] [one of: "pass", "deliver", "restart"]
cache_condition String Name of the cache condition controlling when this configuration applies. [optional]
name String Name for the cache settings object. [optional]
stale_ttl Number Maximum time in seconds to continue to use a stale version of the object if future requests to your backend server fail (also known as 'stale if error'). [optional]
ttl Number Maximum time to consider the object fresh in the cache (the cache 'time to live'). [optional]

Return type

CacheSettingResponse

[Back to top] [Back to API list] [Back to README]