Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wandenberg/nginx-selective-cache-purge-module
https://github.com/wandenberg/nginx-selective-cache-purge-module
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/wandenberg/nginx-selective-cache-purge-module
- Owner: wandenberg
- Created: 2013-03-04T20:20:13.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T21:29:22.000Z (3 months ago)
- Last Synced: 2025-01-04T20:11:43.317Z (8 days ago)
- Language: C
- Size: 613 KB
- Stars: 127
- Watchers: 20
- Forks: 20
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- Authors: AUTHORS
Awesome Lists containing this project
- awesome-nginx - nginx-selective-cache-purge-module - A module to purge cache by GLOB patterns.. (Third Party Modules / C Modules)
README
Nginx Selective Cache Purge Module
==================================A module to purge cache by GLOB patterns. The supported patterns are the same as supported by [Redis](http://redis.io/commands/KEYS).
_This module is not distributed with the Nginx source. See [the installation instructions](#installation-instructions)._
Configuration
-------------An example:
```nginx
pid logs/nginx.pid;
error_log logs/nginx-main_error.log debug;# Development Mode
# master_process off;
# daemon off;
worker_processes 1;
worker_rlimit_core 500M;
working_directory /tmp;
debug_points abort;events {
worker_connections 1024;
#use kqueue; # MacOS
use epoll; # Linux
}http {
default_type application/octet-stream;access_log logs/nginx-http_access.log;
error_log logs/nginx-http_error.log;proxy_cache_path /tmp/cache_zone levels=1:2 keys_zone=zone:10m inactive=10d max_size=100m;
proxy_cache_path /tmp/cache_other_zone levels=1:2 keys_zone=other_zone:1m inactive=1d max_size=10m;#selective_cache_purge_redis_unix_socket "/tmp/redis.sock";
#
# or
#
#selective_cache_purge_redis_host "localhost";
#selective_cache_purge_redis_port 6379;selective_cache_purge_redis_database 1;
server {
listen 8080;
server_name localhost;# purging by prefix
location ~ /purge(.*) {
selective_cache_purge_query "$1*";
}location / {
proxy_pass http://localhost:8081;proxy_cache zone;
proxy_cache_key "$uri";
proxy_cache_valid 200 1m;
}
}server {
listen 8090;
server_name localhost;# purging by extension
location ~ /purge/.*(\..*)$ {
#purge by extension
selective_cache_purge_query "*$1";
}location / {
proxy_pass http://localhost:8081;proxy_cache other_zone;
proxy_cache_key "$uri";
proxy_cache_valid 200 1m;
}
}server {
listen 8081;
server_name localhost;location / {
return 200 "requested url: $uri\n";
}
}
}
```Installation instructions
-------------------------This module requires:
- Redis 2.8 or newer. Install it with your favourite package manager - apt-get, yum, brew - or download [Redis](http://redis.io/download) and compile it.
- hiredis 0.11.0. Install it with your favourite package manager - apt-get, yum, brew - or download [hiredis](https://github.com/redis/hiredis/releases) and compile it.
- [redis_nginx_adapter](https://github.com/wandenberg/redis_nginx_adapter) library[Download Nginx Stable](http://nginx.org/en/download.html) source and uncompress it. You must then run ./configure with --add-module pointing to this project as usual, referencing the up-to-date hiredis/redis_nginx_adapter lib and include if they are not on your default lib and include folders. Something in the lines of:
```bash
$ ./configure \
--with-ld-opt='-L/usr/lib/ ' \
--with-cc-opt='-I/usr/include/hiredis/ ' \
--add-module=/path/to/nginx-selective-cache-purge-module
$ make
$ make install
```Running tests
-------------This project uses [nginx_test_helper](https://github.com/wandenberg/nginx_test_helper) on the test suite. So, after you've installed the module, you can just install the necessary gems:
```bash
$ bundle install --gemfile=test/Gemfile
```And run rspec pointing to where your Nginx binary is (default: /usr/local/nginx/sbin/nginx):
```bash
$ NGINX_EXEC=/path/to/nginx rspec test/
```Changelog
---------This is still a work in progress. Be the change. And take a look on the [Changelog](Changelog.md).