This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from redis import Redis # type: ignore | |
| from redis.client import Script # type: ignore | |
| def register_set_if_higher(redis: Redis) -> Script: | |
| """ | |
| Returns a redis script taking one key and one argument. | |
| It sets the value in the key to be equal to the argument, iff the current value is unset or lower. | |
| It returns the amount the value was increased by, or the number itself, if the key was unset. | |
| """ |