casbin-rs / actix-casbin-auth

Casbin Actix-web access control middleware
https://github.com/casbin/casbin-rs
55 stars 15 forks source link

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

Closed tyjyhapple closed 3 years ago

tyjyhapple commented 4 years ago

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

hsluoyz commented 4 years ago

@GopherJ @xcaptain @hackerchai

GopherJ commented 4 years ago

@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

hsluoyz commented 3 years ago

Closed as stale.