123456789101112131415161718192021222324252627282930 |
- import json
- from django.conf import settings
- from operation.models import LatestAppInfo
- from utils.redis.rkeys import LATEST_APP_INFO
- r = settings.REDIS_CACHE
- def set_latest_app():
- """ 设置最新 APP 信息 """
- try:
- appinfo = LatestAppInfo.objects.all()[0].data
- except IndexError:
- appinfo = {}
- r.set(LATEST_APP_INFO, json.dumps(appinfo))
- return appinfo
- def get_latest_app():
- """ 获取最新 APP 信息 """
- return json.loads(r.get(LATEST_APP_INFO) or '{}') or set_latest_app()
|