Version: v19.0.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2019 License: MPL-2.0 Imports: 2 Imported by: 0



The purge-cache service is responsible for tracking cache-purge requests.

User create purge requests for specific caches on specific workers, and these requests are timestamped. Workers consult the service before starting a new task, and purge any caches older than the timestamp.


How to use this package

First create a PurgeCache object:

purgeCache := tcpurgecache.New(nil)

and then call one or more of purgeCache's methods, e.g.:

err := purgeCache.Ping(.....)

handling any errors...

if err != nil {
	// handle error...

Taskcluster Schema

The source code of this go package was auto-generated from the API definition at <rootUrl>/references/purge-cache/v1/api.json together with the input and output schemas it references,



This section is empty.


This section is empty.


This section is empty.


type OpenAllPurgeRequestsList

type OpenAllPurgeRequestsList struct {

	// Passed back from Azure to allow us to page through long result sets.
	ContinuationToken string `json:"continuationToken,omitempty"`

	// A list of Purge Cache requests that the Purge Cache service has previously received.
	Requests []PurgeCacheRequestsEntry `json:"requests"`

A list of currently open purge-cache requests. Should not be used by workers.

type OpenPurgeRequestList

type OpenPurgeRequestList struct {

	// A list of Purge Cache requests that the Purge Cache service has previously received.
	Requests []PurgeCacheRequestsEntry `json:"requests"`

A list of currently open purge-cache requests.

type PurgeCache

type PurgeCache tcclient.Client

func New

func New(credentials *tcclient.Credentials, rootURL string) *PurgeCache

New returns a PurgeCache client, configured to run against production. Pass in nil credentials to create a client without authentication. The returned client is mutable, so returned settings can be altered.

purgeCache := tcpurgecache.New(
    nil,                                      // client without authentication
    "http://localhost:1234/my/taskcluster",   // taskcluster hosted at this root URL on local machine
err := purgeCache.Ping(.....)                 // for example, call the Ping(.....) API endpoint (described further down)...
if err != nil {
	// handle errors...

func NewFromEnv

func NewFromEnv() *PurgeCache

NewFromEnv returns a *PurgeCache configured from environment variables.

The root URL is taken from TASKCLUSTER_PROXY_URL if set to a non-empty string, otherwise from TASKCLUSTER_ROOT_URL if set, otherwise the empty string.

The credentials are taken from environment variables:


If TASKCLUSTER_CLIENT_ID is empty/unset, authentication will be disabled.

func (*PurgeCache) AllPurgeRequests

func (purgeCache *PurgeCache) AllPurgeRequests(continuationToken, limit string) (*OpenAllPurgeRequestsList, error)

View all active purge requests.

This is useful mostly for administors to view the set of open purge requests. It should not be used by workers. They should use the purgeRequests endpoint that is specific to their workerType and provisionerId.

See #allPurgeRequests

func (*PurgeCache) Ping

func (purgeCache *PurgeCache) Ping() error

Respond without doing anything. This endpoint is used to check that the service is up.

See #ping

func (*PurgeCache) PurgeCache

func (purgeCache *PurgeCache) PurgeCache(provisionerId, workerType string, payload *PurgeCacheRequest) error

Publish a request to purge caches named `cacheName` with on `provisionerId`/`workerType` workers.

If such a request already exists, its `before` timestamp is updated to the current time.

Required scopes:


See #purgeCache

func (*PurgeCache) PurgeRequests

func (purgeCache *PurgeCache) PurgeRequests(provisionerId, workerType, since string) (*OpenPurgeRequestList, error)

List the caches for this `provisionerId`/`workerType` that should to be purged if they are from before the time given in the response.

This is intended to be used by workers to determine which caches to purge.

See #purgeRequests

type PurgeCacheRequest

type PurgeCacheRequest struct {

	// Name of cache to purge. Notice that if a `workerType` have multiple kinds
	// of caches (with independent names), it should purge all caches identified
	// by `cacheName` regardless of cache type.
	CacheName string `json:"cacheName"`

Request that a message be published to purge a specific cache.

type PurgeCacheRequestsEntry

type PurgeCacheRequestsEntry struct {

	// All caches that match this provisionerId, workerType, and cacheName must be destroyed if they were created _before_ this time.
	Before tcclient.Time `json:"before"`

	// Name of cache to purge.
	CacheName string `json:"cacheName"`

	// ProvisionerId associated with the workerType.
	// Syntax:     ^([a-zA-Z0-9-_]*)$
	// Min length: 1
	// Max length: 38
	ProvisionerID string `json:"provisionerId"`

	// Workertype cache exists on.
	// Syntax:     ^([a-zA-Z0-9-_]*)$
	// Min length: 1
	// Max length: 38
	WorkerType string `json:"workerType"`

An entry in a list of Purge Cache Requests that the Purge Cache service has previously received.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL