summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorBen Greenberg <bgreenberg@eventbrite.com>2017-06-14 17:03:34 -0700
committerBen Greenberg <bgreenberg@eventbrite.com>2017-06-14 17:03:34 -0700
commitf49f7d27592a5ed1e7f27f032c1e54d646154c89 (patch)
treed4fe9a1cd2c8b0a34258dc62e20d4bfab45feb58 /redis/client.py
parentd6c300b39ab4c81cd97b81fcd8d25a9cde9476e7 (diff)
downloadredis-py-f49f7d27592a5ed1e7f27f032c1e54d646154c89.tar.gz
Precalculate sha1 of the script on Script instantiation
Diffstat (limited to 'redis/client.py')
-rwxr-xr-xredis/client.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py
index 98764ca..385579a 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -6,6 +6,7 @@ import warnings
import time
import threading
import time as mod_time
+import hashlib
from redis._compat import (b, basestring, bytes, imap, iteritems, iterkeys,
itervalues, izip, long, nativestr, unicode,
safe_unicode)
@@ -2932,7 +2933,7 @@ class Script(object):
def __init__(self, registered_client, script):
self.registered_client = registered_client
self.script = script
- self.sha = ''
+ self.sha = hashlib.sha1(script).hexdigest()
def __call__(self, keys=[], args=[], client=None):
"Execute the script, passing any required ``args``"