add caching, add to stats

This commit is contained in:
C committed 2026-01-05 16:01:36 -08:00
1 parent ab3297acfb
commit dfd2c2f07d
5 files changed
+62 -6

No files matched your search

+3 -1
View File
@@ -11,6 +11,7 @@ import math
import dotenv
from typing import Dict, Any, Optional
from datetime import datetime, timedelta
from async_lru import alru_cache
from . import throttler
Throttler = throttler.GlobalThrottler
@@ -155,9 +156,10 @@ class AsyncBricksetAPI:
self.logger.info("Successfully authenticated with Brickset API")
return result
@alru_cache(maxsize=1000, ttl=604800) # Cache 1000 sets, 7 days TTL
async def get_set(self, set_number: int) -> Dict[str, Any]:
"""
Fetch LEGO set information asynchronously
Fetch LEGO set information asynchronously (cached for 7 days)
Args:
set_number (str): LEGO set number