cache

  • full name: lasyten.cache

  • parent module: lasyten

  • type: module

Declared in lasyten/cache.py; the caches are implemented in C++ (include/lasyten/tools/lru_cache.h). Their sizes are set by the config options su_n_symbol_cache_mb, tree_plan_cache_mb and tree_size_memo_mb (see lasyten.config). The block data of open packed symbol files (su_n_packed_ram_mb) is held outside these budgets.

Functions

lasyten.cache.cache_info() → dict[str, dict[str, int]][source]

Statistics of all caches.

Returns:

Keys 'symbols', 'tree_plans' and 'tree_sizes'; each maps to a dict with the entries hits, misses, evictions, rejected (insertions that were not cached), entries, bytes (estimated size of the stored entries) and capacity_bytes. The key 'packed_files' maps to the memory held by open SU(N) symbol files in the packed layout, which is not part of the symbol cache budget: files, index_bytes and data_bytes_in_ram.

Return type:

dict

lasyten.cache.clear_caches() → None[source]

Remove all entries from all caches (the hit/miss counters are kept).

This also releases the symmetries (and their open data files) that cached tree plans still held. It is registered to run at interpreter exit, so that the symmetries are destroyed while Python is still fully functional.