# union.cache

## Directory

### Classes

| Class | Description |
|-|-|
| [`CacheFunctionBody`](https://www.union.ai/docs/v1/union/api-reference/union-sdk/packages/union.cache/page.md#unioncachecachefunctionbody) | A class that implements a versioning mechanism for functions by generating. |

## union.cache.CacheFunctionBody

A class that implements a versioning mechanism for functions by generating
a SHA-256 hash of the function's source code combined with a salt.

### Methods

| Method | Description |
|-|-|
| [`get_version()`](#get_version) | This method generates a version string for a function by hashing the function's source code. |

#### get_version()

```python
def get_version(
    salt: str,
    params: flytekit.core.cache.VersionParameters,
) -> str
```
This method generates a version string for a function by hashing the function's source code
combined with a salt.

| Parameter | Type | Description |
|-|-|-|
| `salt` | `str` | A string that is used to salt the hash. |
| `params` | `flytekit.core.cache.VersionParameters` | VersionParameters object that contains the parameters (e.g. function, ImageSpec, etc.) that are used to generate the version. |

**Returns:** A string that represents the version of the function.

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/union-sdk/packages/union.cache.md
**HTML**: https://www.union.ai/docs/v1/union/api-reference/union-sdk/packages/union.cache/
