A port of `java.util.*SummaryStatistics` as a Redis Module

Overview

RedisNumbersStats

  • RedisNumbersStats is a Redis module that implements a Redis version of the Java Util *SummaryStatistics classes, such as DoubleSummaryStatistics
  • This module is useful when dealing with a stream of numbers. It maintains a state data structure for collecting statistics such as count, min, max, sum, and average.
  • RedisNumbersStats is built using redismodule-rs, an idiomatic Rust API for the Redis Modules API.

Build

Make sure you have Rust installed: https://www.rust-lang.org/tools/install

Then, build as usual:

cargo build

Make sure you have Redis installed.

Run

Linux

redis-server --loadmodule ./target/debug/libredis_ns.dylib

Mac OS

redis-server --loadmodule ./target/debug/libredis_ns.dylib

An Example

127.0.0.1:6379> MODULE LIST
1) 1) "name"
   2) "rns"
   3) "ver"
   4) (integer) 1
   5) "path"
   6) "./target/debug/libredis_ns.dylib"
   7) "args"
   8) (empty array)
127.0.0.1:6379> KEYS *
(empty array)
127.0.0.1:6379> NS.CREATE team1:ages
(integer) 1
127.0.0.1:6379> NS.INFO team1:ages
1) Count
2) (integer) 0
3) Min
4) N/A
5) Max
6) N/A
7) Sum
8) "0"
127.0.0.1:6379> NS.ACCEPT team1:ages 22
(integer) 1
127.0.0.1:6379> NS.ACCEPT team1:ages 19
(integer) 1
127.0.0.1:6379> NS.ACCEPT team1:ages 25
(integer) 1
127.0.0.1:6379> NS.ACCEPT team1:ages 23
(integer) 1
127.0.0.1:6379> NS.ACCEPT team1:ages 28
(integer) 1
127.0.0.1:6379> NS.INFO team1:ages
1) Count
2) (integer) 5
3) Min
4) "19"
5) Max
6) "28"
7) Sum
8) "117"
127.0.0.1:6379> NS.AVERAGE team1:ages
"23.399999999999999"
127.0.0.1:6379> NS.CREATE team2:ages
(integer) 1
127.0.0.1:6379> NS.ACCEPT team2:ages 42
(integer) 1
127.0.0.1:6379> NS.ACCEPT team2:ages 32
(integer) 1
127.0.0.1:6379> NS.ACCEPT team2:ages 18
(integer) 1
127.0.0.1:6379> NS.INFO team2:ages
1) Count
2) (integer) 3
3) Min
4) "18"
5) Max
6) "42"
7) Sum
8) "92"
127.0.0.1:6379> NS.AVERAGE team2:ages
"30.666666666666668"
127.0.0.1:6379> NS.MERGE team3:ages team1:ages team2:ages
(integer) 2
127.0.0.1:6379> NS.INFO team3:ages
1) Count
2) (integer) 8
3) Min
4) "18"
5) Max
6) "42"
7) Sum
8) "209"
127.0.0.1:6379> NS.AVERAGE team3:ages
"26.125"
127.0.0.1:6379>

License

MIT

You might also like...
A simplified version of a Redis server supporting SET/GET commands

This is a starting point for Rust solutions to the "Build Your Own Redis" Challenge. In this challenge, you'll build a toy Redis clone that's capable

An intentionally-limited Rust implementation of the Redis server with no external dependencies.

lil-redis An intentionally-limited Rust implementation of the Redis server. lil redis is an accessible implementation of a very basic Redis server (wi

Macros for redis-rs to serialize and deserialize structs automatically

redis-macros Simple macros and wrappers to redis-rs to automatically serialize and deserialize structs with serde. Installation To install it, simply

A cross-platform redis gui client

Redis-Manager A cross-platform redis gui client started developing with Tauri, React and Typescript in Vite. Get Started Prerequisites Install Node.js

📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS
📺 Netflix in Rust/ React-TS/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Kafka, Redis, Tokio, Actix, Elasticsearch, Influxdb Iox, Tensorflow, AWS

Fullstack Movie Streaming Platform 📺 Netflix in RUST/ NextJS, Actix-Web, Async Apollo-GraphQl, Cassandra/ ScyllaDB, Async SQLx, Spark, Kafka, Redis,

Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe
Lightweight async Redis client with connection pooling written in pure Rust and 100% memory safe

redi-rs (or redirs) redi-rs is a Lightweight Redis client with connection pooling written in Rust and 100% memory safe redi-rs is a Redis client writt

Simple and flexible queue implementation for Rust with support for multiple backends (Redis, RabbitMQ, SQS, etc.)

Omniqueue Omniqueue is an abstraction layer over queue backends for Rust. It includes support for RabbitMQ, Redis streams, and SQS out of the box. The

Sharded, concurrent mini redis that support http interface implemented in rust

Rudis A mini version of redis server that provides http interface implemented in Rust. The in-memorry kv-storage is sharded and concurrent safe. Inspi

Automatically publish MongoDB changes to Redis for Meteor.

changestream-to-redis Warning The project is currently in its alpha phase. There are no production loads using it yet nor any large-scale tests were c

Owner
Brian Sam-Bodden
Brian Sam-Bodden is an author, instructor, speaker and hacker that has spent over twenty years crafting software systems and teaching others what not to do.
Brian Sam-Bodden
[POC] Redis Module for TiKV

RedisTikvPoc [POC] Redis Module for TiKV This is a POC repository. This Redis Module will add branch new Redis commands to operate TiKV data. After bu

Rain Li 6 Jun 25, 2022
Redis re-implemented in Rust.

rsedis Redis re-implemented in Rust. Why? To learn Rust. Use Cases rsedis does not rely on UNIX-specific features. Windows users can run it as a repla

Sebastian Waisbrot 1.6k Jan 6, 2023
Redis library for rust

redis-rs Redis-rs is a high level redis library for Rust. It provides convenient access to all Redis functionality through a very flexible but low-lev

Armin Ronacher 2.8k Jan 8, 2023
RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

Qovery 145 Nov 23, 2022
RedisJSON - a JSON data type for Redis

RedisJSON RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating a

null 3.4k Jan 1, 2023
A rust Key-Value store based on Redis.

Key-Value Store A Key-Value store that uses Redis to store data. Built using an async web framework in Rust with a full Command-Line interface and log

Miguel David Salcedo 0 Jan 14, 2022
Incomplete Redis client and server implementation using Tokio - for learning purposes only

mini-redis mini-redis is an incomplete, idiomatic implementation of a Redis client and server built with Tokio. The intent of this project is to provi

Tokio 2.3k Jan 4, 2023
Basic Redis Protocol specification in Rust

Basic Redis Protocol specification in Rust

Bruno 1 Jan 20, 2022
Rewrite Redis in Rust for evaluation and learning.

Drill-Redis This library has been created for the purpose of evaluating Rust functionality and performance. As such, it has not been fully tested. The

Akira Kawahara 3 Oct 18, 2022
Redis compatible server framework for Rust

Redis compatible server framework for Rust Features Create a fast custom Redis compatible server in Rust Simple API. Support for pipelining and telnet

Josh Baker 61 Nov 12, 2022