|
71 | 71 | end |
72 | 72 |
|
73 | 73 |
|
74 | | -local fetch_key_from_memc |
| 74 | +local fetch_key_from_memc, locks_shdict_name |
| 75 | +local memc_host, memc_port, memc_timeout, memc_conn_pool_size |
| 76 | +local memc_fetch_retries, memc_fetch_retry_delay, memc_conn_max_idle_time |
75 | 77 | do |
76 | 78 | local memc_shdict = require "resty.memcached.shdict" |
77 | 79 | local fetch_key_from_memc = memc_shdict.gen_memc_methods{ |
78 | | - debug_logger = dlog, |
79 | | - warn_logger = warn, |
80 | | - error_logger = error_log, |
81 | | - disable_shdict = disable_shm_cache, |
82 | | - shdict_set = meta_shdict_set, |
83 | | - shdict_get = meta_shdict_get, |
84 | | - } |
| 80 | + tag = "ticket_memc", |
| 81 | + |
| 82 | + debug_logger = dlog, |
| 83 | + warn_logger = warn, |
| 84 | + error_logger = error_log, |
| 85 | + |
| 86 | + locks_shdict_name = locks_shdict_name, |
| 87 | + |
| 88 | + disable_shdict = disable_shm_cache, |
| 89 | + |
| 90 | + shdict_set = meta_shdict_set, |
| 91 | + shdict_get = meta_shdict_get, |
| 92 | + |
| 93 | + memc_host = memc_host, |
| 94 | + memc_port = memc_port, |
| 95 | + memc_timeout = memc_timeout, |
| 96 | + memc_conn_pool_size = memc_conn_pool_size, |
| 97 | + memc_fetch_retries = memc_fetch_retries, |
| 98 | + memc_fetch_retry_delay = memc_fetch_retry_delay, |
| 99 | + |
| 100 | + memc_conn_max_idle_time = memc_conn_max_idle_time, |
| 101 | + |
| 102 | + memc_store_retries = 0, |
| 103 | + memc_store_retry_delay = 0, |
| 104 | + } |
85 | 105 | end |
86 | 106 |
|
87 | 107 |
|
@@ -249,10 +269,20 @@ function _M.init(opts) |
249 | 269 | time_slot = opts.key_rotation_period |
250 | 270 | memc_key_prefix = opts.memc_key_prefix |
251 | 271 |
|
252 | | - shdict_name = opts.shdict_name |
| 272 | + shdict_name = opts.cache_shdict_name |
253 | 273 | shm_cache_pos_ttl = opts.shm_cache_positive_ttl |
254 | 274 | shm_cache_neg_ttl = opts.shm_cache_negative_ttl |
255 | 275 | disable_shm_cache = opts.disable_shm_cache |
| 276 | + locks_shdict_name = opts.locks_shdict_name |
| 277 | + |
| 278 | + memc_host = opts.memc_host |
| 279 | + memc_port = opts.memc_port |
| 280 | + memc_timeout = opts.memc_timeout |
| 281 | + memc_conn_pool_size = opts.memc_conn_pool_size |
| 282 | + memc_fetch_retries = opts.memc_fetch_retries |
| 283 | + memc_fetch_retry_delay = opts.memc_fetch_retry_delay |
| 284 | + |
| 285 | + memc_conn_max_idle_time = opts.memc_conn_max_idle_time |
256 | 286 |
|
257 | 287 | local frandom = assert(io.open("/dev/urandom", "rb")) |
258 | 288 | fallback_random_key = frandom:read(48) |
|
0 commit comments