openresty / openresty/srcache-nginx-module

Why still get into srcache_store handler even if $srcache_expire=0?

Open
#45 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
486
Forks
101
Avg merge
1h 28m
Merged PRs (30d)
2

Description

I just put my srcache settings directly under server block:

server {
    set $canonical_host www.example.com;

    # ...

    srcache_default_expire 0;
    set_escape_uri $pagecache_key $canonical_host$uri$is_args$args;
    srcache_fetch GET /pagecache key=$pagecache_key;
    srcache_store PUT /pagecache key=$pagecache_key&exptime=$srcache_expire;
    include srcache_status_headers;

    # ...
}

You see, I use srcache_default_expire, So the $srcache_expire will default to 0,
I expect my upstream setting their appropriate exptime by max-age.

However, my srcache_store get involved even if $srcache_expire==0,
and then cause an extra useless redis request.

location = /redis_put {
    # tested OK with SSDB
    internal;
    set_unescape_uri $exptime $arg_exptime;

    redis2_query setx $redis_key $echo_request_body $exptime;

    redis2_pass pagecache_ssdb;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the srcache_default_expire and srcache_store directive handling in the module and reproduce the supplied server configuration. Check whether an expire value of 0 is intended to suppress the store subrequest; done means avoiding the extra Redis request while preserving upstream max-age behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, nginx
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.