Caching

An introduction to caching with Terality and how to enable/disable it.

Terality caches your computation results by default. Results are typically cached for 3 days.

When a result is retrieved from cache, Terality returns immediately the cached result, skipping the computation, and displays the following message:

The result of <operation> was retrieved from cache.

This caching feature decreases execution times on repeated computation operations and thus offers a better user experience.

Import functions (such as read_parquet) are also cached. Terality detects automatically whether the source dataset has changed and will skip loading data when possible.

Disabling cache

You can disable the cache on all operations by simply wrapping your code with the disable_cache() context manager. This might be useful for benchmarking Terality's execution speed.

import terality as te

with te.disable_cache():
   df = te.read_csv("data.csv")

Hiding the helper message

You can disable the caching log message by setting the logging level for theterality logger to a level higher than INFO , like WARNING for example:

import logging
import terality as te

logging.getLogger("terality").setLevel(logging.WARNING)

Last updated