SourceSnapshotCache

SourceSnapshotCache()

A cache that uses a snapshot of the source file as the cache key.

SourceSnapshotCache creates a snapshot-based cache, which is useful when you want to cache results based on the exact state of the source data. The cache is not invalidated when the source file changes. Persistence depends on the source backend. Ideal for one-off analyses or when you want manual control over cache invalidation.

Parameters

Name Type Description Default
source Backend The backend to use for execution. Defaults to xorq’s default backend. required

Example

import xorq.api as xo
from xorq.caching import SourceSnapshotCache

con = xo.connect()
storage = SourceSnapshotCache.from_kwargs(source=con)

cached = expr.cache(storage)
result = xo.execute(cached)