The page you navigated to () does not exist, so we brought you to the closest page to it.
You have switched from the to the variant of this site. There is no equivalent of . We have taken you to the closest page in the variant.
2.1.7
CachePolicy
Package: flyte
Protocol for custom cache version strategies.
Implement get_version(salt, params) -> str to define how cache versions
are computed. The default implementation is FunctionBodyPolicy, which
hashes the function source code.
Example custom policy:
class GitHashPolicy:
def get_version(self, salt: str, params: VersionParameters) -> str:
import subprocess
git_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()
return hashlib.sha256(f"{salt}{git_hash}".encode()).hexdigest()protocol CachePolicy()Methods
| Method | Description |
|---|---|
get_version() |
get_version()
def get_version(
salt: str,
params: flyte._cache.cache.VersionParameters,
) -> str| Parameter | Type | Description |
|---|---|---|
salt |
str |
|
params |
flyte._cache.cache.VersionParameters |