0
0
Azurecloud~10 mins

Cache-aside pattern in Azure - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if the data exists in the cache.

Azure
if cache.[1](key):
Drag options to blanks, or click blank then click option'
Aexists
Bcontains
Cget
Dhas_key
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' instead of a method that checks existence.
Using 'contains' which is not a valid method here.
2fill in blank
medium

Complete the code to retrieve data from the cache.

Azure
data = cache.[1](key)
Drag options to blanks, or click blank then click option'
Aget
Bfetch
Cretrieve
Dload
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'fetch' or 'retrieve' which are not valid cache methods.
Using 'load' which is not a cache method.
3fill in blank
hard

Fix the error in the code to store data in the cache.

Azure
cache.[1](key, data, expiration=3600)
Drag options to blanks, or click blank then click option'
Astore
Bsave
Cset
Dput
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'store' or 'put' which are not valid Azure Cache methods.
Using 'save' which is not a cache method.
4fill in blank
hard

Fill both blanks to implement cache-aside pattern: fetch from cache or load from database.

Azure
if not cache.[1](key):
    data = database.[2](key)
    cache.set(key, data)
Drag options to blanks, or click blank then click option'
Ahas_key
Bfetch
Cget
Dload
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' in first blank which retrieves data but does not check existence.
Using 'fetch' for database which is not the method here.
5fill in blank
hard

Fill all three blanks to complete cache-aside pattern with expiration time.

Azure
if not cache.[1](key):
    data = database.[2](key)
    cache.[3](key, data, expiration=300)
Drag options to blanks, or click blank then click option'
Ahas_key
Bload
Cset
Dget
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' instead of 'exists' to check existence.
Using 'fetch' instead of 'load' for database.
Using 'save' instead of 'set' to store cache.