Skip to content

Commit

Permalink
Update redis cache prefix separator to : (#387)
Browse files Browse the repository at this point in the history
* Update redis cache prefix separator to `:`

* Update refresh token redis prefix
  • Loading branch information
wu-clan authored Aug 22, 2024
1 parent 2002068 commit b43c08b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions backend/app/admin/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class AdminSettings(BaseSettings):
OAUTH2_FRONTEND_REDIRECT_URI: str = 'http://localhost:5173/oauth2/callback'

# Captcha
CAPTCHA_LOGIN_REDIS_PREFIX: str = 'fba_login_captcha'
CAPTCHA_LOGIN_REDIS_PREFIX: str = 'fba:login:captcha'
CAPTCHA_LOGIN_EXPIRE_SECONDS: int = 60 * 5 # 过期时间,单位:秒

# Config
CONFIG_REDIS_KEY: str = 'fba_config'
CONFIG_REDIS_KEY: str = 'fba:config'


@lru_cache
Expand Down
2 changes: 1 addition & 1 deletion backend/app/task/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TaskSettings(BaseSettings):

# Celery
CELERY_BROKER: Literal['rabbitmq', 'redis'] = 'redis'
CELERY_BACKEND_REDIS_PREFIX: str = 'fba_celery'
CELERY_BACKEND_REDIS_PREFIX: str = 'fba:celery'
CELERY_BACKEND_REDIS_TIMEOUT: float = 5.0
CELERY_TASKS_PACKAGES: list[str] = [
'app.task.celery_task',
Expand Down
12 changes: 6 additions & 6 deletions backend/core/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def validate_openapi_url(cls, values):
LOCATION_PARSE: Literal['online', 'offline', 'false'] = 'offline'

# Limiter
LIMITER_REDIS_PREFIX: str = 'fba_limiter'
LIMITER_REDIS_PREFIX: str = 'fba:limiter'

# DateTime
DATETIME_TIMEZONE: str = 'Asia/Shanghai'
Expand All @@ -85,14 +85,14 @@ def validate_openapi_url(cls, values):
TOKEN_ALGORITHM: str = 'HS256' # 算法
TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 1 # 过期时间,单位:秒
TOKEN_REFRESH_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # 刷新过期时间,单位:秒
TOKEN_REDIS_PREFIX: str = 'fba_token'
TOKEN_REFRESH_REDIS_PREFIX: str = 'fba_refresh_token'
TOKEN_REDIS_PREFIX: str = 'fba:token'
TOKEN_REFRESH_REDIS_PREFIX: str = 'fba:token:refresh'
TOKEN_EXCLUDE: list[str] = [ # JWT / RBAC 白名单
f'{API_V1_STR}/auth/login',
]

# Sys User
USER_REDIS_PREFIX: str = 'fba_user'
USER_REDIS_PREFIX: str = 'fba:user'
USER_REDIS_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7

# Log
Expand All @@ -107,7 +107,7 @@ def validate_openapi_url(cls, values):

# RBAC Permission
PERMISSION_MODE: Literal['casbin', 'role-menu'] = 'casbin'
PERMISSION_REDIS_PREFIX: str = 'fba_permission'
PERMISSION_REDIS_PREFIX: str = 'fba:permission'

# Casbin Auth
CASBIN_EXCLUDE: set[tuple[str, str]] = {
Expand Down Expand Up @@ -139,7 +139,7 @@ def validate_openapi_url(cls, values):
]

# Ip location
IP_LOCATION_REDIS_PREFIX: str = 'fba_ip_location'
IP_LOCATION_REDIS_PREFIX: str = 'fba:ip:location'
IP_LOCATION_EXPIRE_SECONDS: int = 60 * 60 * 24 * 1 # 过期时间,单位:秒


Expand Down

0 comments on commit b43c08b

Please sign in to comment.