GithubHelp home page GithubHelp logo

Redis not working about flask-caching HOT 5 CLOSED

pallets-eco avatar pallets-eco commented on July 28, 2024
Redis not working

from flask-caching.

Comments (5)

sh4nks avatar sh4nks commented on July 28, 2024

It looks like it is using RedisCache from werkzeug directly instead of the 'wrapper' around RedisCache. Have you tried setting app.config['CACHE_TYPE'] to redis?

from flask-caching.

jkgeyti avatar jkgeyti commented on July 28, 2024

It was due to the package redis not being installed.

I don't know where I got the idea of using RedisCache directly from, but flask-caching could probably throw a better error than simply swallowing the ImportError in backends.py. I'm also not sure RedisCache should be exposed at all from the module?

backends.py lines 68-99

# RedisCache is supported since Werkzeug 0.7.
try:
    from werkzeug.contrib.cache import RedisCache 
    from redis import from_url as redis_from_url
except ImportError:
    pass 
else:
    def redis(app, config, args, kwargs):
        ...
        return RedisCache(*args, **kwargs)

from flask-caching.

sh4nks avatar sh4nks commented on July 28, 2024

Yeah I think it shouldn't be exposed. If you want you can open a new PR for this. Otherwise I'll try to find some time this evening :)

from flask-caching.

jkgeyti avatar jkgeyti commented on July 28, 2024

The suggested modification imports redis and RedisCache at the time of calling redis(), instead of at import time. I don't know if that causes any problems?

from flask-caching.

jkgeyti avatar jkgeyti commented on July 28, 2024

Solved: #14

from flask-caching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.