⬅︎ Back to Combining Django signals with in-memory LRU cache
Yeah, it's fraught. You need to be careful when you have depend on something like `gunicorn wsgi -w 2` which I actually do for my Django server. Another solution is using a TTL cache from `cachetools` and setting it to something like 60 seconds just to feel a little safer.
This looks like it won’t work in multi-thread/process servers as the signal is only sent/received in one thread.
Comment
Yeah, it's fraught. You need to be careful when you have depend on something like `gunicorn wsgi -w 2` which I actually do for my Django server.
Another solution is using a TTL cache from `cachetools` and setting it to something like 60 seconds just to feel a little safer.
Parent comment
This looks like it won’t work in multi-thread/process servers as the signal is only sent/received in one thread.