chore: remove unused cache.py file
File was identified as unused with no external references in the codebase. This cleanup reduces codebase clutter and potential confusion.
This commit is contained in:
43
cache.py
43
cache.py
@@ -1,43 +0,0 @@
|
|||||||
# In-memory cache for Filevine projects
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
from datetime import datetime, timedelta
|
|
||||||
|
|
||||||
class ProjectCache:
|
|
||||||
def __init__(self):
|
|
||||||
self._cache = {}
|
|
||||||
self._lock = threading.Lock()
|
|
||||||
self._last_updated = None
|
|
||||||
self._is_updating = False
|
|
||||||
|
|
||||||
def get_projects(self):
|
|
||||||
"""Get cached projects if they exist and are not expired (15 minutes)"""
|
|
||||||
with self._lock:
|
|
||||||
if not self._cache or not self._last_updated:
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Check if cache is older than 15 minutes
|
|
||||||
if datetime.now() - self._last_updated > timedelta(minutes=15):
|
|
||||||
return None
|
|
||||||
|
|
||||||
return self._cache.copy()
|
|
||||||
|
|
||||||
def set_projects(self, projects):
|
|
||||||
print(f"Caching new projects: {len(projects)}")
|
|
||||||
"""Set projects in cache with current timestamp"""
|
|
||||||
with self._lock:
|
|
||||||
self._cache = projects.copy() if projects else {}
|
|
||||||
self._last_updated = datetime.now()
|
|
||||||
|
|
||||||
def is_updating(self):
|
|
||||||
"""Check if cache is currently being updated"""
|
|
||||||
with self._lock:
|
|
||||||
return self._is_updating
|
|
||||||
|
|
||||||
def set_updating(self, updating):
|
|
||||||
"""Set the updating status"""
|
|
||||||
with self._lock:
|
|
||||||
self._is_updating = updating
|
|
||||||
|
|
||||||
# Global cache instance
|
|
||||||
project_cache = ProjectCache()
|
|
||||||
Reference in New Issue
Block a user