# Update/Delete cache entry

**URL:** <https://www.ruby-forum.com/t/update-delete-cache-entry/215831>\
**Category:** NGINX\
**Created:** [January 17, 2012, 10:14am UTC](https://www.ruby-forum.com/t/update-delete-cache-entry/215831 "2012-01-17T10:14:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 17, 2012, 10:14am UTC](https://www.ruby-forum.com/t/update-delete-cache-entry/215831/1 "2012-01-17T10:14:27Z")

</div>

Hi guys,

I have an entry cache with nginx :

head -n10 /tmp/nginx/f/a78359efac162eed0807e0d85761441f  
8?O��������(1O]� �D�  
KEY: [http://www.bbc.co.uk/](http://www.bbc.co.uk/)  
HTTP/1.1 200 OK  
Server: Apache  
Vary:  
X-Country,Accept-Encoding,X-Ip\_is\_advertise\_combined,X-Ip\_is\_uk\_combined,  
X-GeoIP  
X-Cache-Action: PASS (non-cacheable)  
Cache-Control: private, max-age=60  
X-Cache-Age: 0  
Content-Type: text/html  
Content-Encoding: gzip

I’d like update this entry before expired time of cache, so I will bash  
a script to delete the entry file match the URL.  
I read that the cache file name is generated from md5sum of URL.  
But when I use command :

echo “[http://www.bbc.co.uk/](http://www.bbc.co.uk/)” | md5sum  
5dc8a729e141d2e783c2c7e710e42fa8

The result does not match the filename cached ?!  
Is there any relation from file name and linux command md5sum ?

and is there another way to update/delete an entry of cache ?

Thank you.  
Brs  
Atrus@

Posted at Nginx Forum:

> **[Update/Delete cache entry.](https://forum.nginx.org/read.php?2,221355,221355#msg-221355)**
>
> Hi guys, I have an entry cache with nginx : head -n10 /tmp/nginx/f/a78359efac162eed0807e0d85761441f 8?O��������(1O\]� �D� KEY: http://www.bbc.co.uk/ HTTP/1.1 200 OK Server: Apache Vary: X-Country,Accept-Enc

---

<div class="post-metadata">

**Author:** ![atrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@atrus](https://www.ruby-forum.com/u/atrus)\
**Post date:** [January 17, 2012, 11:03am UTC](https://www.ruby-forum.com/t/update-delete-cache-entry/215831/2 "2012-01-17T11:03:25Z")

</div>

On Tue, Jan 17, 2012 at 04:13:44AM -0500, atrus wrote:

Hi there,

Half an answer:

> I have an entry cache with nginx :
> 
> head -n10 /tmp/nginx/f/a78359efac162eed0807e0d85761441f

> I read that the cache file name is generated from md5sum of URL.  
> But when I use command :
> 
> echo “[http://www.bbc.co.uk/](http://www.bbc.co.uk/)” | md5sum  
> 5dc8a729e141d2e783c2c7e710e42fa8
> 
> The result does not match the filename cached ?!

“echo x” generates “x newline”.

Use “echo -n x”, or (better) “printf %s x”

> Is there any relation from file name and linux command md5sum ?

Yes, but you must use exactly the url.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![atrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@atrus](https://www.ruby-forum.com/u/atrus)\
**Post date:** [January 17, 2012, 1:57pm UTC](https://www.ruby-forum.com/t/update-delete-cache-entry/215831/3 "2012-01-17T13:57:39Z")

</div>

On 17 Jan 2012 09h13 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi guys,
> 
> I have an entry cache with nginx :

AFAIK there are two ways to purge the Nginx cache.

1. Using grep throughout the cache directories to find and then  
remove the file.

2. Using an HTTP “method” PURGE.

For the first this might be helpful:

> **[GitHub - perusio/nginx-cache-purge: A bash script for deleting items from Nginx cache](https://github.com/perusio/nginx-cache-purge)**
>
> A bash script for deleting items from Nginx cache

and for the later use this:

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

— appa

---

<div class="post-metadata">

**Author:** ![atrus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@atrus](https://www.ruby-forum.com/u/atrus)\
**Post date:** [January 17, 2012, 3:38pm UTC](https://www.ruby-forum.com/t/update-delete-cache-entry/215831/4 "2012-01-17T15:38:50Z")

</div>

Thanks guys.  
I’ll have a try and result later.

Brs.  
Atrus@

Posted at Nginx Forum:

> **[Re: Update/Delete cache entry.](https://forum.nginx.org/read.php?2,221355,221365#msg-221365)**
>
> Hi guys, I have an entry cache with nginx : head -n10 /tmp/nginx/f/a78359efac162eed0807e0d85761441f 8?O��������(1O\]� �D� KEY: http://www.bbc.co.uk/ HTTP/1.1 200 OK Server: Apache Vary: X-Country,Accept-Enc
