Releases: nginx-modules/ngx_cache_purge
ngx_http_cache_purge v3.0.2
-
Queue Restructuring: The
ngx_http_cache_purge_process_queuefunction was successfully restructured to dequeue the item under the lock and process the directory walk outside of it. -
Vary_Aware Fix:
ngx_http_cache_purge_invalidate_nodewas added to safely updateshmstate, preventing stale memory accounting when deleting variant files. -
Live Reload Config:
ngx_http_cache_purge_init_shm_zonenow correctly locks and propagates new batch_size, throttle_ms, and max_size configurations without dropping the old queue. -
Data Types & Races: The
sizevariable inngx_http_cache_purge_queue_swas changed fromngx_atomic_ttongx_uint_t. A size snapshot (hash) is now captured inside the mutex inngx_http_cache_purge_enqueueto safely log the count. -
C89 / GNU89 Compliance: Mid-scope variables like
deleted,i, andcacheswere moved to the top of their respective blocks in the various handler functions. -
Refactoring & Cleanup: The magic number 6 was replaced with
NGX_CACHE_PURGE_KEY_HDR_OFFSET. Redundant variables (resp_tmpl_len,len) were removed fromsend_response. ANULLcheck forcplcf->confwas added to the access handler. Response size globals were markedconst. -
Configuration Script: The
configfile shebang was updated to#!/bin/sh, and writing to$NGX_AUTOCONF_ERRwas replaced with standard echo output. -
Tests: "TEST 15" covering the
vary_awarepurge path was successfully added tot/basic.t.
ngx_http_cache_purge v3.0.1
Bug Fixes
-
Time Unit Parsing (
cache_purge_throttle_ms): Resolved an issue where bare integers were incorrectly interpreted as seconds instead of milliseconds by the NGINX configuration parser. -
Directive Context & Inheritance (
cache_purge_response_type):-
Fixed a bug that allowed duplicate directives in
httpandservercontexts to silently overwrite each other without error. -
Resolved a flawed context guard that prevented the directive from being correctly recognized in certain scopes.
-
Corrected the
Content-Typeinheritance so that settings at thehttplevel properly propagate down toserverandlocationblocks.
-
-
Code Quality:
-
Fixed a typo in internal macros (renamed
NGX_REPONSE_TYPE_*toNGX_CACHE_PURGE_RESPONSE_TYPE_*). -
Renamed internal variable
resptypetoresponse_typefor better maintainability.
-
Documentation Improvements
-
Expanded
README.md: Added detailed explanations forcache_purge_throttle_msbehavior and the importance of time suffixes. -
Corrected Contexts: Updated the documentation to reflect that
cache_purge_response_typeis valid inhttp,server, andlocationcontexts. -
Performance Tuning: Updated the configuration examples and the "Throughput ceiling" formula to clarify how millisecond values impact purge rates.
ngx_http_cache_purge v3.0.0
Asynchronous Purging and Memory Optimization
Major release. Contains breaking internal changes.
Review the updated README before upgrading.
Background Queue System
- Implemented asynchronous purge processing to avoid blocking request workers.
- Added shared memory queue that persists across worker restarts.
- Configurable throttling to limit CPU and I/O impact under purge load.
- Queue flood protection via size limits and per-item timeouts.
Memory Management
- Fixed critical memory leak in partial purge: allocations were incorrectly
made from the ngx_cycle pool instead of the request pool. - Eliminated per-file heap allocations; switched to stack-based buffers.
- Introduced batch processing and hash-based deduplication to reduce
redundant filesystem I/O.
Security
- Added path traversal protection to all file operations.
- Ensured proper file handle cleanup on all exit paths.
- NOTE: Restrict purge endpoints with allow/deny directives or an auth layer.
Logging
- Unified log prefix "ngx_cache_purge:" across all error and debug messages.
- Added debug-level logging for enqueue, dedup, background walk, and delete paths.
- Silent error paths (shm exhaustion, access denied, cache miss) now emit
proper log entries at the correct severity level.
Infrastructure
- Migrated CI from Travis CI to GitHub Actions.
- Test matrix covers NGINX 1.20 through 1.29 on Ubuntu 20.04 and 24.04.
- Replaced legacy .t test files with a Dockerized test suite.
- Added Makefile for local builds.
ngx_http_cache_purge v2.5.6
- nginx 1.29.4 changed ngx_http_proxy_loc_conf_t structure which caused segfault on purge request. #52 by @arekm
Full Changelog: 2.5.5...2.5.6
ngx_http_cache_purge v2.5.5
What's Changed
- Fix segfault when using same-location syntax with variable cache zones #50 @dvershinin
Full Changelog: 2.5.4...2.5.5
ngx_http_cache_purge v2.5.4
What's Changed
Full Changelog: 2.5.3...2.5.4
ngx_http_cache_purge v2.5.3
ngx_http_cache_purge v2.5.2
ngx_http_cache_purge v2.5.1
ngx_http_cache_purge v2.4.3
a6df03c empty key check: it coredumps when cache key is empty, Tuğrul Topuz