Lightning Prototyping
Using redis-helper & ipython in the command-line
Resources
- https://docs.python.org/3/tutorial/datastructures.html
- https://redis.io/topics/data-types-intro
- https://redis.io/commands
- https://github.com/andymccurdy/redis-py
- https://github.com/kenjyco/redis-helper
Why Redis?
- super fast in-memory database used by many companies large and small
- it is a "data structure server", so we can make use of efficient operations on a variety of fundamental data structures
- hash
- set
- sorted set
- list
- pub sub
Some Redis Commands
- hash: hmset, hget, hmget, hgetall, hincrby
- set: sadd, srem, scard, smembers, sinterstore, sunionstore
- sorted set: zadd, zrem, zcard, zrange, zrangebyscore, zinterstore
- list: lpush, lpop, rpush, rpop, llen
Why ipython?
- awesome Python interpreter
- tab-completion
- syntax highlighting as you type
- you can embed it in your programs
Why redis-helper?
- low learning curve
- minimal boilerplate
- easy to configure
- very fast
- one-line model definitions
- easy to integrate in existing APIs
- simplifies data access patterns
- gather data or count metrics at multiple time ranges (at once)
- built to explore in the shell
How?
- modify your ~/.config/redis-helper/settings.ini file
- create an instance of redis_helper.Collection
- use the add method to add an item to the collection
- use the get method to get some data about an item in the collection
- use the update method to update/modify data for a particular item in the collection
- use the delete method to delete an item from the collection
- use the index_field_info method to get information about the indexed fields in the collection
- use the find method to filter through indexed fields to find matching items
Demo...
Lightning Prototyping
By Kenneth Wade
Lightning Prototyping
- 1,193