casbin-rs / actix-casbin-auth

Casbin Actix-web access control middleware

Home Page:https://github.com/casbin/casbin-rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enforcer: Arc<RwLock<CachedEnforcer>> why use lock?

tyjyhapple opened this issue · comments

enforcer: Arc<RwLock> why use lock,When I test the performance, the performance drops dramatically under using Rwlock

@tyjyhapple Sorry for the late reply, I believe we can remove the lock only if we can ensure there is no modification on policies.

In this case we can use only Arc.

Also we are using CachedEnforcer so it needs &mut to be able to modify internal cache.

If you have better ideas don't hesitate

Closed as stale.