Skip to content

Releases: nginx-modules/ngx_cache_purge

ngx_http_cache_purge v3.0.2

05 May 12:07
523e663

Choose a tag to compare

  • Queue Restructuring: The ngx_http_cache_purge_process_queue function 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_node was added to safely update shm state, preventing stale memory accounting when deleting variant files.

  • Live Reload Config: ngx_http_cache_purge_init_shm_zone now correctly locks and propagates new batch_size, throttle_ms, and max_size configurations without dropping the old queue.

  • Data Types & Races: The size variable in ngx_http_cache_purge_queue_s was changed from ngx_atomic_t to ngx_uint_t. A size snapshot (hash) is now captured inside the mutex in ngx_http_cache_purge_enqueue to safely log the count.

  • C89 / GNU89 Compliance: Mid-scope variables like deleted, i, and caches were 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 from send_response. A NULL check for cplcf->conf was added to the access handler. Response size globals were marked const.

  • Configuration Script: The config file shebang was updated to #!/bin/sh, and writing to $NGX_AUTOCONF_ERR was replaced with standard echo output.

  • Tests: "TEST 15" covering the vary_aware purge path was successfully added to t/basic.t.

ngx_http_cache_purge v3.0.1

25 Apr 06:09
4e012c1

Choose a tag to compare

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 http and server contexts 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-Type inheritance so that settings at the http level properly propagate down to server and location blocks.

  • Code Quality:

    • Fixed a typo in internal macros (renamed NGX_REPONSE_TYPE_* to NGX_CACHE_PURGE_RESPONSE_TYPE_*).

    • Renamed internal variable resptype to response_type for better maintainability.

Documentation Improvements

  • Expanded README.md: Added detailed explanations for cache_purge_throttle_ms behavior and the importance of time suffixes.

  • Corrected Contexts: Updated the documentation to reflect that cache_purge_response_type is valid in http, server, and location contexts.

  • 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

22 Apr 22:31
84b30a7

Choose a tag to compare

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

17 Feb 16:35
1107b8f

Choose a tag to compare

  • 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

06 Jan 06:19
a0e7ef4

Choose a tag to compare

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

14 Oct 08:33
0780603

Choose a tag to compare

What's Changed

  • Fix memory leak when using partial (wildcard) keys. by @TaylanUB in #46

Full Changelog: 2.5.3...2.5.4

ngx_http_cache_purge v2.5.3

22 Feb 05:10
a84b0f3

Choose a tag to compare

a84b0f3 Fix race-condition with two parallel PURGE (#42)

ngx_http_cache_purge v2.5.2

01 Jun 11:32
a984849

Choose a tag to compare

a984849 Update structs for nginx 1.19.4+ and 1.21.0+ (#41)

ngx_http_cache_purge v2.5.1

27 Jun 04:57

Choose a tag to compare

340da7f empty key check: it coredumps when cache key is empty, Tuğrul Topuz
e60093f purge report calloc fix: Report template has not cache file path but it's length is use in buffer memory allocation, Tuğrul Topuz

ngx_http_cache_purge v2.4.3

27 Jun 04:57

Choose a tag to compare

a6df03c empty key check: it coredumps when cache key is empty, Tuğrul Topuz