Skip to main content

Caching

How it works

Before we start let us check how caching works.

  • We first extend an EventEmitter class and then we create a new Map inside it.
  • Then we use timers to delete the key after 10 minutes (if tts is not specified)

But Why Timeout? Normally, let's say you got your stats, you played a game and want your stats again, we would return cached stats and not the real stats, but if there is a tts for the key, you will get the real stats after cache expires.

Library Comparision

Currently the only libraries which support caching on brawlstars api are brawlstars and us.

brawlstars uses node-cache to cache the data. While it is great library, it is extremely slow and not recommended for use.

We use our own cache way and we are 10x faster in caching than brawlstars with node-cache.