feat: cache cli options
This commit is contained in:
parent
2a77f75e6f
commit
0fedfd880e
@ -125,10 +125,12 @@ def cli():
|
||||
cli.set_frontend(silent=False)
|
||||
|
||||
if arguments.clear_cache:
|
||||
cli.clear_cache()
|
||||
from .cli.options import cache
|
||||
cache.clear_cache()
|
||||
|
||||
if arguments.clean_cache:
|
||||
cli.clean_cache()
|
||||
from .cli.options import cache
|
||||
cache.clean_cache()
|
||||
|
||||
# getting the genre
|
||||
genre: str = arguments.genre
|
||||
|
@ -1,8 +1,10 @@
|
||||
from logging import getLogger
|
||||
|
||||
from ..utils import cli_function
|
||||
from ...connection.cache import Cache
|
||||
|
||||
|
||||
@cli_function
|
||||
def clear_cache():
|
||||
"""
|
||||
Deletes the cache.
|
||||
@ -10,8 +12,10 @@ def clear_cache():
|
||||
"""
|
||||
|
||||
Cache("main", getLogger("cache")).clear()
|
||||
print("Cleared cache")
|
||||
|
||||
|
||||
@cli_function
|
||||
def clean_cache():
|
||||
"""
|
||||
Deletes the outdated cache. (all expired cached files, and not indexed files)
|
||||
@ -19,3 +23,4 @@ def clean_cache():
|
||||
"""
|
||||
|
||||
Cache("main", getLogger("cache")).clean()
|
||||
print("Cleaned cache")
|
||||
|
@ -145,6 +145,9 @@ class Cache:
|
||||
keep = set()
|
||||
|
||||
for ca in self.cached_attributes.copy():
|
||||
if ca.name == "":
|
||||
continue
|
||||
|
||||
file = Path(self._dir, ca.module, ca.name)
|
||||
|
||||
if not ca.is_valid:
|
||||
|
Loading…
Reference in New Issue
Block a user