This commit is contained in:
@@ -90,9 +90,14 @@ def init_db():
|
|||||||
def get_cached_data(url, route):
|
def get_cached_data(url, route):
|
||||||
conn = sqlite3.connect(DB_PATH)
|
conn = sqlite3.connect(DB_PATH)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cache_expiry = int(time.time()) - (CACHE_EXPIRY_HOURS * 60 * 60) # Convert hours to seconds
|
|
||||||
|
# Calculate cache expiry time
|
||||||
if route == 'pagination':
|
if route == 'pagination':
|
||||||
cache_expiry = cache_expiry * 31
|
# Pagination cache expires after 31 times the normal cache expiry
|
||||||
|
cache_expiry = int(time.time()) - (CACHE_EXPIRY_HOURS * 31 * 60 * 60)
|
||||||
|
else:
|
||||||
|
cache_expiry = int(time.time()) - (CACHE_EXPIRY_HOURS * 60 * 60) # Convert hours to seconds
|
||||||
|
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"SELECT data FROM cache WHERE url = ? AND route = ? AND timestamp > ?",
|
"SELECT data FROM cache WHERE url = ? AND route = ? AND timestamp > ?",
|
||||||
(url, route, cache_expiry)
|
(url, route, cache_expiry)
|
||||||
|
|||||||
Reference in New Issue
Block a user