Casbin Forum runs on Casnode, the open-source Discourse-style forum. Try the Casnode demo →
Casbin Forum

Hi, I'm reading the docs, experimenting with Casbin for my web app, and using Postgresql for storage. Here's my understanding of how Casbin works. Casbin loads the policies from storage (via the adapter) into memory (the enforcer). When a policy changes, for example a new user is added, that is done using a call to the enforcer. The enforcer then persists that change via the storage adapter. If the web app consists of multiple processes - for example many gunicorn workers - then each process will have its own enforcer. Each enforcer is independent. Therefore each enforcer must periodically reload policies from storage to see policy changes made in other processes. One way to do this is to use a watcher. That is my understanding so far.

If there are a large number of policies in the store, and if they change with high frequency, will performance degrade because each watcher is constantly reloading all the policies into the enforcer in each process? Is there a standard technique to ensure that enforcers are not continually reloading all the policies?