cloudflare / cloudflare/lua-upstream-cache-nginx-module

the module is unvalid when upstream_cache_status is HIT

Offen
#9 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C
Sterne
124
Forks
40
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

hi:
I use the module to set meta info when upstream_cache_status is HIT, but I found this is unvalid.

code:
header_filter_by_lua '
local http_cache = require("http_cache")
local cache_status = (ngx.var.upstream_cache_status or "")

if cache_status == "HIT" and ngx.ctx.flag == "true" then
local cache_data = http_cache.get_metadata()
local new_expire = ngx.time() - 1

if cache_data and cache_data["valid_sec"] then
http_cache.set_metadata({ valid_sec = new_expire,
fcn = { valid_sec = new_expire,
expire = new_expire } })
end
end
';

Can I use it like this? thx!

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reproducing the shown header_filter_by_lua configuration with upstream_cache_status set to HIT, then inspect the module's metadata API and its handling of this request phase. Done means establishing whether set_metadata is supported in this situation and documenting or correcting the observed behavior.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, lua, nginx
Bereich
backend, infrastructure
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.