Bird
0
0

Which of the following is the correct way to initialize Flask-Caching with SimpleCache in a Flask app?

easy📝 Syntax Q3 of 15
Flask - Middleware and Extensions
Which of the following is the correct way to initialize Flask-Caching with SimpleCache in a Flask app?
Acache = Cache(app, config={'CACHE_TYPE': 'FileCache'})
Bcache = Cache(app, config={'CACHE_TYPE': 'RedisCache'})
Ccache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'})
Dcache = Cache(app, config={'CACHE_TYPE': 'MemcachedCache'})
Step-by-Step Solution
Solution:
  1. Step 1: Check correct cache type name for SimpleCache

    The correct config key for SimpleCache is 'SimpleCache'.
  2. Step 2: Match option with correct config

    cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'}) uses 'SimpleCache' correctly; others use wrong cache types.
  3. Final Answer:

    cache = Cache(app, config={'CACHE_TYPE': 'SimpleCache'}) -> Option C
  4. Quick Check:

    SimpleCache config = 'SimpleCache' [OK]
Quick Trick: Use 'SimpleCache' string exactly in config [OK]
Common Mistakes:
MISTAKES
  • Using wrong cache type strings
  • Misspelling 'SimpleCache'
  • Confusing Redis with SimpleCache

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes