MCPcopy
hub / github.com/redis/redis-py / get_encoder

Method get_encoder

redis/commands/core.py:10528–10544  ·  view source on GitHub ↗

Get the encoder to encode string scripts into bytes.

(self)

Source from the content-addressed store, hash-verified

10526 return client.evalsha(self.sha, len(keys), *args)
10527
10528 def get_encoder(self):
10529 """Get the encoder to encode string scripts into bytes."""
10530 try:
10531 return self.registered_client.get_encoder()
10532 except AttributeError:
10533 # DEPRECATED
10534 # In version <=4.1.2, this was the code we used to get the encoder.
10535 # However, after 4.1.2 we added support for scripting in clustered
10536 # redis. ClusteredRedis doesn't have a `.connection_pool` attribute
10537 # so we changed the Script class to use
10538 # `self.registered_client.get_encoder` (see above).
10539 # However, that is technically a breaking change, as consumers who
10540 # use Scripts directly might inject a `registered_client` that
10541 # doesn't have a `.get_encoder` field. This try/except prevents us
10542 # from breaking backward-compatibility. Ideally, it would be
10543 # removed in the next major release.
10544 return self.registered_client.connection_pool.get_encoder()
10545
10546
10547class AsyncScript:

Callers 4

__init__Method · 0.95
acl_setuserMethod · 0.45
digest_localMethod · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected