# Programmatic access to Nginx fcgi/proxy cache?

**URL:** <https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259>\
**Category:** NGINX\
**Created:** [January 12, 2012, 5:56pm UTC](https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259 "2012-01-12T17:56:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Lancaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f07891/32.png) [@Ben\_Lancaster](https://www.ruby-forum.com/u/Ben_Lancaster)\
**Post date:** [January 12, 2012, 5:56pm UTC](https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259/1 "2012-01-12T17:56:37Z")

</div>

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)

---

<div class="post-metadata">

**Author:** ![Ben\_Lancaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f07891/32.png) [@Ben\_Lancaster](https://www.ruby-forum.com/u/Ben_Lancaster)\
**Post date:** [January 12, 2012, 6:28pm UTC](https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259/2 "2012-01-12T18:28:11Z")

</div>

On 12 Jan 2012 15h15 WET, removed\_email\_address@domain.invalid wrote:

You can process the cache files. They’re regular files.

Here’s a script to inspect the cache:

> **[GitHub - perusio/nginx-cache-inspector: Script that allows to inspect the...](https://github.com/perusio/nginx-cache-inspector)**
>
> Script that allows to inspect the Nginx cache. Contribute to perusio/nginx-cache-inspector development by creating an account on GitHub.

another for purging:

> **[GitHub - perusio/nginx-cache-purge: A bash script for deleting items from...](https://github.com/perusio/nginx-cache-purge)**
>
> A bash script for deleting items from Nginx cache. Contribute to perusio/nginx-cache-purge development by creating an account on GitHub.

There’s also a 3rd party module for cache purging. AFAIK doesn’t  
support wildcards:

> **[GitHub - FRiCKLE/ngx\_cache\_purge: nginx module which adds ability to purge...](https://github.com/FRiCKLE/ngx_cache_purge)**
>
> nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches. - GitHub - FRiCKLE/ngx\_cache\_purge: nginx module which adds ability to purge content from FastCGI, proxy...

Just make a HTTP request from your app.

— appa

---

<div class="post-metadata">

**Author:** ![Ben\_Lancaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f07891/32.png) [@Ben\_Lancaster](https://www.ruby-forum.com/u/Ben_Lancaster)\
**Post date:** [January 12, 2012, 7:56pm UTC](https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259/3 "2012-01-12T19:56:51Z")

</div>

Hi,

> There’s also a 3rd party module for cache purging. AFAIK doesn’t  
> support wildcards:
> 
> [GitHub - FRiCKLE/ngx\_cache\_purge: nginx module which adds ability to purge content from FastCGI, proxy, SCGI and uWSGI caches. · GitHub](https://github.com/FRiCKLE/ngx_cache_purge)

It doesn’t, but because of that it’s the only one of those mentioned  
that  
works at scale.

Best regards,  
Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>

---

<div class="post-metadata">

**Author:** ![Ben\_Lancaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f07891/32.png) [@Ben\_Lancaster](https://www.ruby-forum.com/u/Ben_Lancaster)\
**Post date:** [January 13, 2012, 4:46pm UTC](https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259/4 "2012-01-13T16:46:59Z")

</div>

On Jan 13, 2012, at 8:57 AM, Martin Loy wrote:

> [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpMemcachedModule)

the memc module is better for this, at least in my experience:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpRedis)

only does gets. redis2 module supports most redis commands:

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

I had issues in the past with the app writing into the cache and nginx  
reading from it. Partially because of the numerous apps we run nginx in  
front of. I like nginx doing the reading and the writing.

this has worked well: [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxHttpSRCacheModule)  
Or some simple lua using location captures.

if you used redis, for example, you could do something in lua to do the  
purging that took regexes fairly easily.

–Brian

---

<div class="post-metadata">

**Author:** ![Ben\_Lancaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f07891/32.png) [@Ben\_Lancaster](https://www.ruby-forum.com/u/Ben_Lancaster)\
**Post date:** [January 13, 2012, 2:58pm UTC](https://www.ruby-forum.com/t/programmatic-access-to-nginx-fcgi-proxy-cache/226259/5 "2012-01-13T14:58:21Z")

</div>

Ben

Why not use memcached/redis/etc as cache backend instead of file based  
cache, nginx works with them great and you just need to populate the  
cache  
at application level 🙂

[http://wiki.nginx.org/HttpMemcachedModule](http://wiki.nginx.org/HttpMemcachedModule)

> **[HTTP Redis | NGINX](https://www.nginx.com/resources/wiki/modules/redis/)**
>
> The HTTP Redis module provides support for caching with Redis.

Regards

M
