Skip to content

Commit c97476e

Browse files
committed
cleanup
1 parent de1cda3 commit c97476e

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Port to serve app on.
22
PORT = 5000
3-
LOCAL_REDIS_URL = redis://username:password@localhost:6379
3+
LOCAL_REDIS_URL = redis://localhost:6379

app/caches.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def get_cache(namespace) -> Union[aiocache.RedisCache, aiocache.SimpleMemoryCach
3636

3737

3838
async def check_cache(data_id: str, namespace: str = None):
39+
"""Check the data of a cache given an id."""
3940
cache = get_cache(namespace)
4041
result = await cache.get(data_id, None)
4142
LOGGER.info(f"{data_id} cache pulled")
@@ -44,6 +45,7 @@ async def check_cache(data_id: str, namespace: str = None):
4445

4546

4647
async def load_cache(data_id: str, data, namespace: str = None, cache_life: int = 3600):
48+
"""Load data into the cache."""
4749
cache = get_cache(namespace)
4850
await cache.set(data_id, data, ttl=cache_life)
4951
LOGGER.info(f"{data_id} cache loaded")

app/services/location/jhu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from asyncache import cached
99
from cachetools import TTLCache
1010

11-
from ...caches import check_cache, get_cache, load_cache
11+
from ...caches import check_cache, load_cache
1212
from ...coordinates import Coordinates
1313
from ...location import TimelinedLocation
1414
from ...timeline import Timeline

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
-i https://pypi.org/simple
2+
aiocache[redis]==0.11.1
23
aiohttp==3.6.2
4+
aioredis==1.3.1
35
async-timeout==3.0.1
46
asyncache==0.1.1
57
attrs==19.3.0
@@ -11,6 +13,7 @@ dataclasses==0.6 ; python_version < '3.7'
1113
fastapi==0.54.1
1214
gunicorn==20.0.4
1315
h11==0.9.0
16+
hiredis==1.0.1
1417
httptools==0.1.1 ; sys_platform != 'win32' and sys_platform != 'cygwin' and platform_python_implementation != 'PyPy'
1518
idna-ssl==1.1.0 ; python_version < '3.7'
1619
idna==2.9

0 commit comments

Comments
 (0)