Computational Thinking + Doing

NoSQL In-Memory Databases

Managing cached data—using Redis, Amazon ElastiCache, Azure Cache for Redis, and GCP Memorystore.

Getting Started

Python has emerged as the de facto language for data engineering. Python’s popularity in the data engineering community is primarily due to its versatility, ease of use, and a rich ecosystem of libraries and frameworks that support various data engineering tasks.

If you are interested in reproducing this work, here are the versions of Python and Python packages. Additionally, my coding style here is verbose, in order to trace back where functions/methods and variables are originating from, and make this a learning experience for everyone—including me.

import sys
print(sys.version)
3.11.4 (v3.11.4:d2340ef257, Jun  6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)]
!pip install redis==4.6.0
!pip install hiredis==2.2.3
import redis
import hiredis

Since it’s always wise to start locally and avoid any cloud-related costs, I’ve deployed the tech stack locally (via Docker). Once I have confidence that I can reproduce the work on the cloud, I proceed to (just then) spin-up cloud instances on Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP).

r = redis.Redis(host="localhost", port=6379, decode_responses=True)
r.set("foo", "bar")
True
r.get("foo")
'bar'
r.hset("user-session:123", mapping={
    "name": "John",
    "surname": "Smith",
    "company": "Redis",
    "age": 29
})
0
r.hgetall("user-session:123")
{'name': 'John', 'surname': 'Smith', 'company': 'Redis', 'age': '29'}

References

  • Silberschatz, A., Korth, H. F., & Sudarshan, S. (2020). Database System Concepts (3rd ed.). McGraw Hill.
  • Perkins, L., Redmond, E., & Wilson, J. (2018). Seven Databases in Seven Weeks (2 ed.). O’Reilly.
  • Lemahieu, W., vanden Broucke, S., & Baesens, B. (2018). Principles of Database Management: The Practical Guide to Storing, Managing and Analyzing Big and Small Data. Cambridge University Press. https://doi.org/10.1017/9781316888773
  • Carlson, J. L. (2013). Redis in Action. Manning.
Applied Computing