RoniFinTech commited on
Commit
6547a33
1 Parent(s): 3e81177
Files changed (1) hide show
  1. cache/local_cache.py +6 -6
cache/local_cache.py CHANGED
@@ -24,16 +24,16 @@ def ttl_cache(key_name, media_type=None, ttl_secs=20):
24
  del _cache[key]
25
  del _cache_time[key]
26
  else:
27
- if media_type == 'image/png':
28
- return StreamingResponse(BytesIO(_cache[key]), media_type=media_type)
29
- else:
30
- return _cache[key]
31
 
32
  # Call the actual function if not in cache or expired
33
  response = await func(*args, **kwargs)
34
-
35
  # Cache the result
36
- _cache[key] = response
37
  _cache_time[key] = datetime.now()
38
 
39
  return response
 
24
  del _cache[key]
25
  del _cache_time[key]
26
  else:
27
+ # if media_type == 'image/png':
28
+ # return StreamingResponse(BytesIO(_cache[key]), media_type=media_type)
29
+ # else:
30
+ return _cache[key]
31
 
32
  # Call the actual function if not in cache or expired
33
  response = await func(*args, **kwargs)
34
+ print(response)
35
  # Cache the result
36
+ _cache[key] = response.body
37
  _cache_time[key] = datetime.now()
38
 
39
  return response