Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Redis Clusters in RedisSessionInterface #263

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/flask_session/redis/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional

from flask import Flask
from redis import Redis
from redis import Redis, RedisCluster

from .._utils import total_seconds
from ..base import ServerSideSession, ServerSideSessionInterface
Expand Down Expand Up @@ -40,14 +40,14 @@ class RedisSessionInterface(ServerSideSessionInterface):
def __init__(
self,
app: Flask,
client: Optional[Redis] = Defaults.SESSION_REDIS,
client: Optional[Redis | RedisCluster] = Defaults.SESSION_REDIS,
key_prefix: str = Defaults.SESSION_KEY_PREFIX,
use_signer: bool = Defaults.SESSION_USE_SIGNER,
permanent: bool = Defaults.SESSION_PERMANENT,
sid_length: int = Defaults.SESSION_ID_LENGTH,
serialization_format: str = Defaults.SESSION_SERIALIZATION_FORMAT,
):
if client is None or not isinstance(client, Redis):
if client is None or not (isinstance(client, Redis) or isinstance(client, RedisCluster)):
warnings.warn(
"No valid Redis instance provided, attempting to create a new instance on localhost with default settings.",
RuntimeWarning,
Expand Down
Loading