Skip to content

Commit

Permalink
storage/redis: key prefixing logic change (#12)
Browse files Browse the repository at this point in the history
if a key is already prefixed correctly, do not prefix it again.
this allows full keys returned by `find_keys` to be used directly
with `get`, `set`, etc.
  • Loading branch information
pirogoeth authored Sep 10, 2020
1 parent 5f8d9a3 commit 1950b1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion machine/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
__description__ = "A sexy, simple, yet powerful and extendable Slack bot"
__uri__ = "https://github.com/DandyDev/slack-machine"

__version_info__ = (0, 21, 0)
__version_info__ = (0, 21, 1)
__version__ = ".".join(map(str, __version_info__))

__author__ = "Daan Debie"
Expand Down
3 changes: 3 additions & 0 deletions machine/storage/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def _ensure_connected(self):
raise NotConnectedError()

def _prefix(self, key):
if key.startswith(self._key_prefix):
return key

return "{}:{}".format(self._key_prefix, key)

async def has(self, key):
Expand Down

0 comments on commit 1950b1e

Please sign in to comment.