diff options
author | Ben Greenberg <bgreenberg@eventbrite.com> | 2017-06-14 17:03:34 -0700 |
---|---|---|
committer | Ben Greenberg <bgreenberg@eventbrite.com> | 2017-06-14 17:03:34 -0700 |
commit | f49f7d27592a5ed1e7f27f032c1e54d646154c89 (patch) | |
tree | d4fe9a1cd2c8b0a34258dc62e20d4bfab45feb58 /redis/client.py | |
parent | d6c300b39ab4c81cd97b81fcd8d25a9cde9476e7 (diff) | |
download | redis-py-f49f7d27592a5ed1e7f27f032c1e54d646154c89.tar.gz |
Precalculate sha1 of the script on Script instantiation
Diffstat (limited to 'redis/client.py')
-rwxr-xr-x | redis/client.py | 3 |
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``" |