Ir al contenido principal

Multithreading

In multi-threaded code, use Casbin’s synchronized enforcer so one enforcer can be shared safely across threads: SyncedEnforcer (Go), enforcer_synced.cpp (C++).

The synced enforcer can also auto-reload policy: call StartAutoLoadPolicy() to poll the policy source and reload when it changes; call StopAutoLoadPolicy() to stop.

For running several instances, caching and keeping policy in sync, see Production Deployment.

Comments are powered by giscus and GitHub Discussions. They load from giscus.app and GitHub only after you click the button below.