A Python client for zedis
Project description
ZEDIS
A lightweight zeromq and seld based replacement for Redis. <90 LOC focused on a portable cross language simple storage system. No need to run a full service.
Install
Recommended Install
This will always fetch and build the most recent version of zedis for your computer. If you don't have cargo checkout https://www.rust-lang.org/tools/install
cargo install zedis
Not supporting apt
and homebrew
anymore, too many places to update.
Run 👍
zedis
# _______ ___ ___ ___
# |_ / __| \_ _/ __|
# / /| _|| |) | |\__ \
# /___|___|___/___|___/
#
Zedis is opinionated and limited. With ZEDIS you can only READ and WRITE key values pairs. All writes overwrite past values.
Really Fast reads < 250µs
for ~2 MB
json payload.
Pretty Fast writes < 18ms
for ~2 MB
json payload.
Setting Port
Now you can set the port/socket that zedis
will be available on. If no port is specified zedis will fallback on 5555
zedis 6677
Interacting with CLI app
Commands
Get values
GET key
Return the string values of the key. Returns b'Error occurred: InvalidKey'
if key does not exist
Set values
SET key value
Insert a key value. If the key already exists the value will be overwritten.
Remove values
DEL key
Delete a key and it's value from zedis. This will also return the last known value of the key.
Show keys
KEYS
This retrns a JSON format list of all of the keys. This is ineffiecent, it iterates through the whole DB and then concats the key names togther. Do not use if you have more than 1000 keys if you want instant results.
Query
PRE keyprefix
Returns all keys with that prefix. So "A" will return "Alpha", "Awesome"... this is case sensitive.
Python3 client example
import zmq
import json
port = "5555"
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://localhost:%s" % port)
socket.send_string("SET david richard blyn holtz");socket.recv()
# 'done.'
socket._string("GET david");socket.recv()
# 'richard blyn holtz'
jsonblob = json.dumps({"example": "you can store seralized JSON"})
socket.send_string("SET js "+jsonblob);socket.recv()
# 'done.'
socket.send_string("GET js")
json.loads(socket.recv())
# {u'exmple': u'lorem ipsum...'}
socket.send_string("DEL js");socket.recv();socket.recv()
# b'2 yo yo'
## ADDING A BUNCH OF KEYS
for x in range(0, 100):
socket.send_string("SET "+str(x)+" "+str(x)+" yo yo")
socket.recv()
socket.send_string("PRE 1");socket.recv()
# b'["1", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"]'
socket.send_string("KEYS");socket.recv()
# b'["0", "1", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22"]'
Check alive
nc -v -z -w 5 localhost 5555
# found 0 associations
# found 1 connections:
# 1: flags=82<CONNECTED,PREFERRED>
# outif lo0
# src 127.0.0.1 port 52227
# dst 127.0.0.1 port 5555
# rank info not available
# TCP aux info available
# Connection to localhost port 5555 [tcp/personal-agent] succeeded!
🦀 01010
Developer Stuff
Build it
Clone, build and add a symlink so you can access zedis
in the cli
git clone https://github.com/drbh/zedis.git && cd zedis
cargo build --release && sh install.sh
Packaging
fpm -f -s dir -t deb -n zedis target/release/zedis=/usr/local/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyzedis-0.0.1.tar.gz
.
File metadata
- Download URL: pyzedis-0.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7970a7552d6c4090727356b209d460136f6321aa5eb11e8892053e990cfb2fa |
|
MD5 | 0b12acd851b33b5aae670fa697383fd6 |
|
BLAKE2b-256 | 22d7941674b9e043a4758bfa4a6a647274081d0e9b2e9446d4be57965430b3d3 |
File details
Details for the file pyzedis-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pyzedis-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9277c42272a7550b4bb9d2c377bcaeb51634647b57375961cd6783df1147e834 |
|
MD5 | e1e49b81528c5e57c11584b1d14fe50a |
|
BLAKE2b-256 | 23f783a1639abaaf90c9fd9c944815d5558c40bcc112f1f30270cb01659e4d49 |