23 lines
414 B
Python
23 lines
414 B
Python
import json
|
|
import redis
|
|
|
|
from settings import settings
|
|
|
|
|
|
class StructCacheFile:
|
|
def __init__(self):
|
|
pass
|
|
|
|
@staticmethod
|
|
def update(db, tb, data):
|
|
with open(f'{db}_{tb}.json', 'w') as f:
|
|
json.dump(data, f)
|
|
|
|
|
|
class StructCacheRedis:
|
|
def __init__(self, rdb):
|
|
self.rdb = rdb
|
|
|
|
def update(self, db, tb, data):
|
|
self.rdb.set(f'{db}_{tb}', json.dumps(data))
|