Skip to content

Refactor canvas caching

Current implementation will grab every pixel that's labeled as "isTop" and concatenate all of the hex values into a 1D redis array stored at Redis.key("canvas")

this works great, when it's for a 100x100 canvas. Not for the 500x500, let alone 1000x1000.

proposed solution:

  • split the canvas into 100x100 chunks that individually get cached using the original strategy
  • when a client connects every chunk is streamed to the client
  • the client should be able to handle this with the renderer#handleBatch