casbin / node-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Node.js and Browser
https://casbin.org
Apache License 2.0
2.61k stars 218 forks source link

[Question] Can the cache stored in memory here be placed in Redis? #469

Closed Lce-Lemon closed 11 months ago

Lce-Lemon commented 11 months ago

When there are multiple instances, there are differences in the cache between instances.

Can the cache stored in memory here be placed in Redis?

casbin-bot commented 11 months ago

@nodece @Shivansh-yadav13

hsluoyz commented 11 months ago

@Lce-Lemon Casbin is memory-first and memory cannot be removed. You need to use watcher to sync between multiple instances: https://casbin.org/docs/watchers/

Lce-Lemon commented 11 months ago

@Lce-Lemon Casbin is memory-first and memory cannot be removed. You need to use watcher to sync between multiple instances: https://casbin.org/docs/watchers/

When using a Watcher in a concurrent environment with frequent permission updates, it may lead to frequent reloading of policy, impacting the performance of the service, especially when there are a large number of policies. In scenarios with concurrent operations and the addition of instances, there might be differences in policy data among multiple instances.