@spectacles/cache

Caching for Discord data.


License
ISC
Install
npm install @spectacles/cache@0.3.12

Documentation

Spectacles cache

Cache Discord objects in a cool way. Currently only supports Redis, but you're welcome to write a custom engine and plug it in.

How to use

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

Data structure

  • guilds
    • members
      • roles
      • presence
    • roles
    • emojis
    • voiceStates
  • channels
    • overwrites
  • users

Actions

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

  • guilds
  • users
  • roles
  • members
  • emojis
  • voiceStates