Lines Matching defs:env

139 redis_init(struct module_env* env, struct cachedb_env* cachedb_env)
151 moddata->numctxs = env->cfg->num_threads;
152 moddata->ctxs = calloc(env->cfg->num_threads, sizeof(redisContext*));
159 moddata->server_host = env->cfg->redis_server_host;
160 moddata->server_port = env->cfg->redis_server_port;
161 moddata->server_path = env->cfg->redis_server_path;
162 moddata->server_password = env->cfg->redis_server_password;
163 moddata->command_timeout.tv_sec = env->cfg->redis_timeout / 1000;
165 (env->cfg->redis_timeout % 1000) * 1000;
166 moddata->connect_timeout.tv_sec = env->cfg->redis_timeout / 1000;
168 (env->cfg->redis_timeout % 1000) * 1000;
169 if(env->cfg->redis_command_timeout != 0) {
171 env->cfg->redis_command_timeout / 1000;
173 (env->cfg->redis_command_timeout % 1000) * 1000;
175 if(env->cfg->redis_connect_timeout != 0) {
177 env->cfg->redis_connect_timeout / 1000;
179 (env->cfg->redis_connect_timeout % 1000) * 1000;
181 moddata->logical_db = env->cfg->redis_logical_db;
191 if(env->cfg->redis_expire_records) {
195 rep = redis_command(env, cachedb_env,
225 redis_deinit(struct module_env* env, struct cachedb_env* cachedb_env)
229 (void)env;
248 redis_command(struct module_env* env, struct cachedb_env* cachedb_env,
256 /* We assume env->alloc->thread_num is a unique ID for each thread
261 log_assert(env->alloc->thread_num < d->numctxs);
262 ctx = d->ctxs[env->alloc->thread_num];
269 d->ctxs[env->alloc->thread_num] = ctx;
282 d->ctxs[env->alloc->thread_num] = NULL;
296 redis_lookup(struct module_env* env, struct cachedb_env* cachedb_env,
312 rep = redis_command(env, cachedb_env, cmdbuf, NULL, 0);
344 redis_store(struct module_env* env, struct cachedb_env* cachedb_env,
349 int set_ttl = (env->cfg->redis_expire_records &&
350 (!env->cfg->serve_expired || env->cfg->serve_expired_ttl > 0));
363 ttl += env->cfg->serve_expired_ttl;
377 rep = redis_command(env, cachedb_env, cmdbuf, data, data_len);