0.3.12 • Published 6 years ago

@spectacles/cache v0.3.12

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

Spectacles cache

Cache Discord objects in a cool way. Currently only supports Redis.

How to use

const { Client } = require('@spectacles/cache');
const Redis = require('ioredis');
const redis = new Redis();
const cache = new Client(redis); // client accepts an ioredis instance
(async () => {
  const role = await cache.guilds['some id'].roles.get('some other id');
  await cache.actions.guilds.upsert({ id: 'meme' }); // etc.
})();

Data structure

The internal data structures closely follows the format of data as returned from Discord. Every structure with an ID that is returned as an array will be converted to an object keyed by ID.

  • guilds
    • members
      • roles
      • presence
    • roles
    • emojis
    • voice_states - keyed by user ID
    • channels
  • channels
    • overwrites
  • users
const memberRoles = await cache.guilds['some id'].members['some id'].roles.get();
// memberRoles is an object { [roleID]: ...roleInfo }

Actions

All actions have 3 methods: set, upsert, and delete which behave as named. They are exposed on Client#actions.

  • guilds
  • channels
  • users
  • roles
  • members
  • emojis
  • voiceStates
cache.actions.guilds.upsert(guild);
0.3.12

6 years ago

0.3.11

6 years ago

0.3.10

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

7 years ago