mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: add Redis Sentinel support to cache settings
This commit is contained in:
parent
0f1d57f0cb
commit
91f68781fe
|
|
@ -66,7 +66,7 @@ class Config(dict):
|
|||
}
|
||||
|
||||
def get_cache_setting(self):
|
||||
return {
|
||||
redis_config = {
|
||||
'default': {
|
||||
'BACKEND': 'django_redis.cache.RedisCache',
|
||||
'LOCATION': f'redis://{self.get("REDIS_HOST")}:{self.get("REDIS_PORT")}/{self.get("REDIS_DB")}',
|
||||
|
|
@ -77,6 +77,13 @@ class Config(dict):
|
|||
},
|
||||
},
|
||||
}
|
||||
if self.get('REDIS_SENTINEL') == 'true':
|
||||
redis_config['default']['OPTIONS']['SENTINEL_SENTINELS'] = self.get('REDIS_SENTINEL_SENTINELS').split(',')
|
||||
redis_config['default']['OPTIONS']['SENTINEL_MASTER_SET'] = self.get('REDIS_SENTINEL_MASTER_SET')
|
||||
redis_config['default']['OPTIONS']['SENTINEL_DB'] = self.get('REDIS_SENTINEL_DB')
|
||||
return redis_config
|
||||
else:
|
||||
return redis_config
|
||||
|
||||
def get_language_code(self):
|
||||
return self.get('LANGUAGE_CODE', 'zh-CN')
|
||||
|
|
|
|||
Loading…
Reference in New Issue