THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class FileBasedCache: (source)
Constructor: FileBasedCache(path, filename, monitored_dirs, monitored_files)
Persist named cache entries in a filesystem directory.
| Method | __collect |
Collect monitored files for hashing and deduplicate them. |
| Method | __collect |
Collect deduplicated Python files from monitored directories. |
| Method | __collect |
Add deduplicated monitored files to the result list. |
| Method | __compute |
Compute and return a hash representing the state of monitored sources. |
| Method | __init__ |
Initialize the FileBasedCache instance. |
| Method | clear |
Remove the cache file if it exists. |
| Method | get |
Retrieve cached data if valid. |
| Method | save |
Save the provided data to the cache file if it has changed. |
| Constant | CACHE |
Cache version value used by FileBasedCache. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | __file |
Resolved filesystem path of the persistent cache entry. |
| Instance Variable | __file |
Store the resolved cache file path for later access. |
| Instance Variable | __hash |
Hash interval value used by FileBasedCache. |
| Instance Variable | __lasthashcheck |
Lasthashcheck value used by FileBasedCache. |
| Instance Variable | __monitored |
List of directories to monitor for changes. |
| Instance Variable | __monitored |
List of files to monitor for changes. |
| Instance Variable | __path |
Directory path where the cache file will be stored. |
| Instance Variable | __sourceshashcache |
Internal cache for source hash and timing. |
Collect monitored files for hashing and deduplicate them.
Gather Python files from monitored directories and explicit monitored files, excluding the cache file itself.
| Returns | |
list[tuple[str, pathlib.Path]] | Sorted (posix_path, resolved_path) pairs for unique monitored files. |
Path, seen: set[ str], result: list[ tuple[ str, Path]]):
(source)
¶
Collect deduplicated Python files from monitored directories.
| Parameters | |
cachepathlib.Path | Resolved cache file path to exclude from collection. |
seen:set[str] | Set of already collected POSIX paths used for deduplication. |
result:list[tuple[str, pathlib.Path]] | Output list updated in place with (posix_path, resolved_path) tuples. |
| Returns | |
None | No return value. |
Path, seen: set[ str], result: list[ tuple[ str, Path]]):
(source)
¶
Add deduplicated monitored files to the result list.
| Parameters | |
cachepathlib.Path | Resolved cache file path to exclude from collection. |
seen:set[str] | Set of already collected POSIX paths used for deduplication. |
result:list[tuple[str, pathlib.Path]] | Output list updated in place with (posix_path, resolved_path) tuples. |
| Returns | |
None | No return value. |
Compute and return a hash representing the state of monitored sources.
This method generates a SHA-1 hash based on the modification time and size of all monitored files and Python files in monitored directories, excluding the cache file itself. The hash is cached for a short interval to avoid redundant computation.
| Returns | |
str | The computed SHA-1 hash as a hexadecimal string. |
Path, filename: str, monitored_dirs: list[ Path] | None = None, monitored_files: list[ Path] | None = None):
(source)
¶
Initialize the FileBasedCache instance.
| Parameters | |
path:pathlib.Path | Directory path where the cache file will be stored. |
filename:str | Name of the cache file. |
monitoredlist[pathlib.Path] or None, optional | List of directories to monitor for changes. |
monitoredlist[pathlib.Path] or None, optional | List of files to monitor for changes. |
| Returns | |
None | No return value. |
| Raises | |
TypeError | If path is not a Path or filename is not a string. |
ValueError | If filename is empty or contains path components. |
Remove the cache file if it exists.
| Returns | |
bool | True if the cache file was removed, False if it did not exist. |