Created
August 19, 2018 01:25
-
-
Save ryanermita/ece0ea1fa5428d9adc06233c572b8cca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dict_object = { | |
"name": "John Doe", | |
"social_media_accounts": ["facebook", "twitter", "Instagram"], | |
"language_proficiency": { | |
"Python": "9/10", | |
"Javascript": "7/10", | |
"Ruby": "8/10" | |
} | |
} | |
type(dict_object) # dict | |
type(dict_object["social_media_accounts"]) # dict | |
type(dict_object["language_proficiency"]) # list | |
# cache dict_object as redis hash | |
app.redis_connection.hmset("your_unique_key", dict_object) | |
# fetch cached data (hash) from redis | |
cached_data = app.redis_connection.hgetall("your_unique_key") | |
type(cached_data) # dict | |
type(cached_data["social_media_accounts"]) # string | |
type(cached_data["language_proficiency"]) # string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment