In this blog you can check some more details on Redis implementation - Medium Blog.
Here, we can get the details of every registered Photographers for the queried zip code, who are using a specific product.
This is a simple Python Based Template where we can leverage the benfits of Redis over using a Regular Database in the Cloud.
-
The Compute Engine (EC2) recives an request from the API Gateway to query photographers in a particular ZIP code, who are using a specific product.
-
The Redis in memory database will return the details if the queried key is present, else
None
. Here, the details will be stored in JSON list Data Structure. -
If the response for the queried data form Redis DB is
None
, the response from SQLite Database will be returned back to the Compute Engine with updating the Key in Redis DB.
- REQUEST:
POST
- URL:
http://127.0.0.1:5001/v1
{
"zipcode": "855058",
"product-name": "ABC"
}
{
"data": [
{
"contact": "232-568-8464",
"name": "Charity",
"email": "cthynnea@gnu.org",
"zipcode": "855058",
"id": 2
}
]
}
Will be added soon.
First of all, clone this using terminal after running-
git clone https://github.com/pranabsarkar/RedisMakesLifeEasier.git
Once, it is cloned run-
cd RedisMakesLifeEasier
Please open terminal in the current directory and run this command to insatall the dependencies-
pip install -r requirements.txt
Open terminal and run this command to start the server -
python app.py
Name: Pranab Sarkar
Please feel free to add your input's :)