Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purge / #10

Open
peixotorms opened this issue May 4, 2022 · 1 comment
Open

Purge / #10

peixotorms opened this issue May 4, 2022 · 1 comment

Comments

@peixotorms
Copy link

Hi

According to the docs:

Request GET /cache/purge/path/to/images/myimage.png to purge that image.
Request GET /cache/purge/images/my* to purge all images that start with my in that path.
Request GET /cache/purge/* to purge all the cache.

But how to purge / only?

If I try GET /cache/purge/ I get

*6 lua entry thread aborted: runtime error: /etc/nginx/lua/cache_multipurge.lua:73: attempt to call field 'sumhexa' (a nil value)
stack traceback:
coroutine 0:
        /etc/nginx/lua/cache_multipurge.lua: in function 'purge_one'
        /etc/nginx/lua/cache_multipurge.lua:91: in main chunk, client: 127.0.0.1
(...)
@peixotorms
Copy link
Author

It looks like my version of lua-md5 did not support the sumhexa function, so I solved it by removing the dependency altogether. Just replace the function purge_one() to let the OS do the md5 directly, rather than rely on the lua module. Pull request sent. #11

function purge_one()
  os.execute( "VAR=$(echo -n "..cmp_cache_key.." | md5sum | awk '{print $1}'); find '"..cmp_cache_path.."' -name ${VAR} -type f -exec rm {} + " )
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant