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:
1
The result of <operation> was retrieved from cache.
Copied!
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.
1
import terality as te
2
3
with te.disable_cache():
4
df = te.read_csv("data.csv")
Copied!

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:
1
import logging
2
import terality as te
3
4
logging.getLogger("terality").setLevel(logging.WARNING)
Copied!
Copy link
Contents