Python formatKey for Redis

/ Published in: Python
Save to your folder(s)

Tiny python closure for combining redis keys with "format".
Uses a closure so it does not remake the base key each use.

Copy this code and paste it in your HTML
  1. def formatKey():
  2. key = '{}:{}'
  3. def fmtK(k1, k2):
  4. return key.format(k1, k2)
  5. return fmtK

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.