Skip to content

Commit 1950b1e

Browse files
authored
storage/redis: key prefixing logic change (#12)
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.
1 parent 5f8d9a3 commit 1950b1e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

machine/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
__description__ = "A sexy, simple, yet powerful and extendable Slack bot"
1515
__uri__ = "https://github.com/DandyDev/slack-machine"
1616

17-
__version_info__ = (0, 21, 0)
17+
__version_info__ = (0, 21, 1)
1818
__version__ = ".".join(map(str, __version_info__))
1919

2020
__author__ = "Daan Debie"

machine/storage/backends/redis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ def _ensure_connected(self):
2424
raise NotConnectedError()
2525

2626
def _prefix(self, key):
27+
if key.startswith(self._key_prefix):
28+
return key
29+
2730
return "{}:{}".format(self._key_prefix, key)
2831

2932
async def has(self, key):

0 commit comments

Comments
 (0)