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

touch-reload style for clearing the cache #85

Closed
unbit opened this issue Dec 12, 2012 · 5 comments
Closed

touch-reload style for clearing the cache #85

unbit opened this issue Dec 12, 2012 · 5 comments

Comments

@unbit
Copy link
Owner

unbit commented Dec 12, 2012

In a project (my company website) i have added

touch-reload = .git/index

to trigger an instance reload whenever the git repository changes. This is mainly to clear the uWSGI cache as each page (after generated) is put there and served using the 'cache internal router'

Reloading the whole server (only to clear the cache) seems overkill, so a

--touch-cache-clear

would be a great (and cheap) solution

@akx
Copy link
Contributor

akx commented Dec 12, 2012

Wouldn't just filemon signals + cache_clear() do?

EDIT: So as to keep the core a little bit leaner, or to have a more "hackable" solution.

@unbit
Copy link
Owner Author

unbit commented Sep 19, 2013

i think the way of "touch" files has been abused (see logrotate and logreopen). The master fifo way is a lot better for sure. We can eventually add a command to clear the cache.

@unbit unbit closed this as completed Sep 19, 2013
@fheslouin
Copy link

I'm looking for a command to clear the cache on certain URI for instance.

Is touch-reload = .git/index the only solution ?

@unbit
Copy link
Owner Author

unbit commented Apr 19, 2017

you could map a file monitor to a uwsgi.cache_clear() api command:

uwsgi.register_file_monitor(0, "/tmp", "worker", do_clear_cache)

def do_clear_cache(signal_number, filename):
    uwsgi.cache_clear()

@fheslouin
Copy link

Thanks @unbit, is there anything that could be used with the internal routing such as http://uwsgi-docs.readthedocs.io/en/latest/InternalRouting.html#the-first-example

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

No branches or pull requests

3 participants