openresty / srcache-nginx-module

Transparent subrequest-based caching layout for arbitrary nginx locations.
http://wiki.nginx.org/NginxHttpSRCacheModule
474 stars 103 forks source link

can't use srcache_store twice in the same location block #71

Closed amewayne closed 6 years ago

amewayne commented 6 years ago

Hi, This is how it goes, I need to set two cache in redis, one (cache A) is designed to return normal page response and will be expired in 15 minutes, and i will refresh cache A when expired. And the other one (cache B) is designed to be stored in redis permanently, and when the backend is shutdown, nginx will return cache B. Cache B will be refreshed when the backend service is available. The problem is how can I set two cache in the same location block? image

agentzh commented 6 years ago

@hqweiyu No, this is not supported by this module without hacks or tricks.

amewayne commented 6 years ago

@agentzh So what's your thoughts in designing this?

agentzh commented 6 years ago

@hqweiyu I suggest you use OpenResty's Lua module for this.