Commit 9108c98
committed
Use SHA1 cache with NOSCRIPT fallback for Redis Cluster Lua scripts
Precompute the Lua script SHA1 locally and always execute scripts via
EVALSHA to avoid repeated SCRIPT LOAD operations.
Add a robust NOSCRIPT fallback to EVAL to ensure compatibility with both
resty.redis and resty.rediscluster, especially in Redis Cluster setups
where scripts are cached per node.
This improves performance and makes script execution resilient to Redis
node restarts, failovers, and resharding.1 parent 8263caa commit 9108c98
1 file changed
+27
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
58 | 75 | | |
59 | 76 | | |
60 | 77 | | |
| |||
66 | 83 | | |
67 | 84 | | |
68 | 85 | | |
69 | | - | |
70 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
71 | 89 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
75 | 94 | | |
76 | 95 | | |
77 | 96 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
0 commit comments