Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis-rank

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-rank

Manage real-time leaderboards using Redis

  • 2.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63
decreased by-86.33%
Maintainers
1
Weekly downloads
 
Created
Source

📊 redis-rank

Manage real-time leaderboards using Redis

Build Status codecov codecov

Features

  • Lightweight: minimal dependencies, only ioredis is required
  • Performance: guaranteed at most one trip to Redis on each function call*, taking advantage of ioredis's pipelining and Lua scripts
  • Drop-in replacement: use any existing sorted set as a leaderboard
  • Clear interface: Promise-based & provides TypeScript definitions
  • Periodic leaderboards: create recurring leaderboards: daily, weekly, monthly, etc or use a custom cycle
  • Combine leaderboards: create a matrix of leaderboards: update, filter and retrieve multiple entries in a single call
  • Export: export your leaderboards for long-term storage
  • Tested: 100% code coverage

Quick Start

⚙️ Install

$ npm install redis-rank ioredis

Redis 2.6.12 or newer is required. The package ioredis is a peer dependency and must be installed separately.

🔗 Import and connect

ES5

const Redis = require('ioredis');
const { Leaderboard, PeriodicLeaderboard, LeaderboardMatrix } = require('redis-rank');

ES6

import { Redis } from 'ioredis';
import { Leaderboard, PeriodicLeaderboard, LeaderboardMatrix } from 'redis-rank';

You will have to provide a ioredis connection. See here for more information.

const client = new Redis({
    host: "127.0.0.1",
    port: 6379
});

You are ready, now read one of the examples linked below!

Examples

API

Running tests

A Redis server in localhost without password is expected.

⚠️ Note: The database #15 will be flushed ⚠️

$ npm test

I tried with ioredis-mock but I experienced some issues with Lua scripts so we have to rely on a real Redis server (which I think is better anyway).

License

MIT. See LICENSE.

Keywords

FAQs

Package last updated on 13 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc