cache
¶
Cache utilities for FFmpeg operations.
Functions:
| Name | Description |
|---|---|
clean |
Clean the cache for a class. |
get_cache_path |
Get the cache directory path. |
list_all |
List all objects of a class in the cache. |
load |
Load an object from the cache. |
save |
Save an object to the cache. |
get_cache_path
¶
get_cache_path() -> Path
Get the cache directory path.
Returns the cache directory path, creating it if it doesn't exist. When running as a frozen application (e.g., PyInstaller), uses the temporary extraction directory. Otherwise, uses the cache subdirectory relative to this module.
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
The cache directory path |
list_all
¶
list_all(cls: type[T]) -> list[T]
List all objects of a class in the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type[T]
|
The class of the objects |
required |
Returns:
| Type | Description |
|---|---|
list[T]
|
A list of all objects of the class in the cache |
load
¶
load(cls: type[T], id: str) -> T
Load an object from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type[T]
|
The class of the object |
required |
id
|
str
|
The id of the object |
required |
Returns:
| Type | Description |
|---|---|
T
|
The loaded object |
save
¶
save(obj: T, id: str) -> None
Save an object to the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
T
|
The object to save |
required |
id
|
str
|
The id of the object |
required |