nhathuy07 commited on
Commit
c5c68c1
·
verified ·
1 Parent(s): 19fd3d0

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -1
main.py CHANGED
@@ -36,7 +36,7 @@ from enum import Enum
36
  from re import sub
37
 
38
  import redis.asyncio as redis
39
- r = redis.Redis(host='localhost', port=6379, db=0)
40
 
41
  import logging
42
 
@@ -75,6 +75,8 @@ async def __internal_tmp_w(id, content:any):
75
  try:
76
  async with r.pipeline(transaction=True) as pipeline:
77
  ok = await pipeline.set(id, json.dumps(content).encode("utf-8")).execute()
 
 
78
  return ok
79
  except Exception as e:
80
  app_logger.info(e)
 
36
  from re import sub
37
 
38
  import redis.asyncio as redis
39
+ r = redis.Redis(host='localhost', port=6379, db=0, cache_enabled=True)
40
 
41
  import logging
42
 
 
75
  try:
76
  async with r.pipeline(transaction=True) as pipeline:
77
  ok = await pipeline.set(id, json.dumps(content).encode("utf-8")).execute()
78
+ r.expire(id, 600)
79
+
80
  return ok
81
  except Exception as e:
82
  app_logger.info(e)