TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Small snippet to dump and restore all data from/to redis

2 pointsby mrmattyboyalmost 8 years ago

1 comment

itamarhaberalmost 8 years ago
No disrespect Matthew, but you&#x27;re doing it very very wrong.<p>Very #1: do not use `KEYS`, use `SCAN` instead. Your script is not only blocking the server, it also consumes a lot of RAM just for holding them while iterating.<p>Very #2: do not use JSON to encode, and no need for the conditional-read-by-type - just use Redis&#x27; `DUMP`<p>P.S. there may be more wrongness ;)