---
title: SurrogateKeyForCacheKey
summary: SurrogateKeyForCacheKey creates a surrogate key for the given cache key and purge scope that is compatible with the Simple Cache API. Each cache entry for the Simple Cache API is configured with surrogate keys from this function.
url: https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/simple/fn.SurrogateKeyForCacheKey/
---

**Kind:** Function  
**Module:** [simple](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/simple/)  
**Package:** compute-sdk-go v1.11.0  
**Source:** https://github.com/fastly/compute-sdk-go/blob/d6bf71b04516ed72d6018cab6fff701a865f86e5/cache/simple/simple.go#L164

```go
func SurrogateKeyForCacheKey(cacheKey []byte, scope PurgeScope) string
```

SurrogateKeyForCacheKey creates a surrogate key for the given cache
key and purge scope that is compatible with the Simple Cache API.
Each cache entry for the Simple Cache API is configured with
surrogate keys from this function.

This function is provided as a convenience for implementors wishing
to add a Simple Cache-compatible surrogate key manually via the Core
Cache API ([github.com/fastly/compute-sdk-go/cache/core](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/core/)) for
interoperability with [Purge](https://www.fastly.com/documentation/reference/compute/sdks/go/compute-sdk-go/cache/simple/fn.Purge/).

**Parameters**

- `cacheKey`: `[]byte`
- `scope`: `PurgeScope`

**Returns**

`string`
