PoloLacoste / r6-api-caching

Simple cache using redis & mongodb for Rainbow Six Siege

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

r6-api-caching

Simple cacher around r6api.js using redis and mongodb.

NPM

Install

npm install r6-api-caching

Usage

import { R6Service } from 'r6-api-caching';

const r6Service = new R6Service('email', 'password');

const platform = 'uplay';
const username = 'Godly';

const id = await r6Service.getId(platform, username);
console.log(`Player id : ${id}`);
Player id : be3313d6-d443-4eae-818f-bb7f56837781

With Redis & Mongodb

import { R6Service, CacheService, MongoDatabase } from 'r6-api-caching';

const r6Service = new R6Service('email', 'password', {
  caching: true,
  expiration: 10 * 60 * 1000 // 10 minutes (default is 1 minute)
  cacheService: new CacheService(
    "redis://localhost:6379"
  ),
  database: new MongoDatabase(
    "mongodb://root:password@localhost:27017"
  )
});

const platform = 'uplay';
const username = 'Godly';

const id = await r6Service.getId(platform, username);
console.log(`Player id : ${id}`);
Player id : be3313d6-d443-4eae-818f-bb7f56837781

Dev

Create a .env file to start the tests.

EMAIL=[UBISOFT ACCOUNT EMAIL]
PASSWORD=[UBISOFT ACCOUNT PASSWORD]

About

Simple cache using redis & mongodb for Rainbow Six Siege

License:MIT License


Languages

Language:TypeScript 99.1%Language:JavaScript 0.9%