mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
manual cache management
This commit is contained in:
@@ -15,9 +15,10 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
|||||||
|
|
||||||
from cache_manager import CacheManager
|
from cache_manager import CacheManager
|
||||||
|
|
||||||
def list_cache_keys(cache_dir):
|
def list_cache_keys(cache_manager):
|
||||||
"""List all available cache keys."""
|
"""List all available cache keys."""
|
||||||
if not os.path.exists(cache_dir):
|
cache_dir = cache_manager.cache_dir
|
||||||
|
if not cache_dir or not os.path.exists(cache_dir):
|
||||||
print(f"Cache directory does not exist: {cache_dir}")
|
print(f"Cache directory does not exist: {cache_dir}")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@@ -69,8 +70,7 @@ def show_cache_info(cache_manager, key=None):
|
|||||||
print(f"Error checking cache key '{key}': {e}")
|
print(f"Error checking cache key '{key}': {e}")
|
||||||
else:
|
else:
|
||||||
# Show all cache keys
|
# Show all cache keys
|
||||||
cache_dir = cache_manager.cache_dir
|
keys = list_cache_keys(cache_manager)
|
||||||
keys = list_cache_keys(cache_dir)
|
|
||||||
if keys:
|
if keys:
|
||||||
print("Available cache keys:")
|
print("Available cache keys:")
|
||||||
for key in sorted(keys):
|
for key in sorted(keys):
|
||||||
@@ -88,13 +88,11 @@ def main():
|
|||||||
help='Clear a specific cache key')
|
help='Clear a specific cache key')
|
||||||
parser.add_argument('--info', '-i', type=str, metavar='KEY',
|
parser.add_argument('--info', '-i', type=str, metavar='KEY',
|
||||||
help='Show information about a specific cache key')
|
help='Show information about a specific cache key')
|
||||||
parser.add_argument('--cache-dir', type=str, default='cache',
|
|
||||||
help='Cache directory path (default: cache)')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Initialize cache manager
|
# Initialize cache manager
|
||||||
cache_manager = CacheManager(cache_dir=args.cache_dir)
|
cache_manager = CacheManager()
|
||||||
|
|
||||||
if args.list:
|
if args.list:
|
||||||
show_cache_info(cache_manager)
|
show_cache_info(cache_manager)
|
||||||
|
|||||||
Reference in New Issue
Block a user