underyx / flask-redis

A Flask extension for using Redis
Other
436 stars 71 forks source link

Allow using redis.StrictRedis instead of hardcoding redis.Redis #11

Closed wbolster closed 9 years ago

wbolster commented 9 years ago

The summary says it all.

rhyselsmore commented 9 years ago

Check the referenced PR @wbolster, let me know if you would prefer this option (where you specify your own redis class), or if you want a 'STRICT" key available to set the strict client.

wbolster commented 9 years ago

Hi @rhyselsmore, thanks for working on this.

redis-py only provides two classes, and one of them (the one used currently by Flask-Redis) only exists for compatibility reasons. My opinion is that a strict=True argument is a better approach here. It's cleaner, since it's just a simple self-explanatory toggle, and also because it doesn't "leak" API from the underlying redis-py library. With the current implementation in PR#13, consuming applications have to import both Flask-Redis and redis itself to use the (recommended) strict API, which I think is rather ugly.

Fwiw, the default can be left as strict=False for backwards compatibility.

slick666 commented 9 years ago

+1 for this. Wanted to use this with flask-kvsession which requires Strict Redis and had to reference the pull request to get it done.

nickw444 commented 9 years ago

+1 for this also, would allow publish to be used.

slick666 commented 9 years ago

w00t!