Casbin = way to authorization
A place for Casbin developers and users
现在注册
已注册用户请  登录
主题样式选择
默认主题样式 ✅
知乎主题样式 
SiggiSmara
Casnode  ›  Casbin

Watcher vs SyncedEnforcer

  •  
  •  
    SiggiSmara · 4年前 · 231 次点击 
    这是一个创建于 1288 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Hello everyone,

    I was wondering if you can give me advice on when to use a Watcher versus a SyncedEnforcer.

    My use case is a fastAPI REST service that spawns several workers, so using pycasbin library. No large volume of request and infrequent changes to policies. Policies are persited in a database using casbin_sqlalchemy_adapter.

    Until now I have been using SyncedEnforcer and that seems to work fine for what I need. Then I started reading about Watchers and was wondering what the real difference between the two is given that they are both taking care of synchronizing policy changes.

    Do I understand it correctly that a SyncedEnforcer is actively checking for updates (pull updates from db) while with a Watcher the Enforcers are subscribing to events (changes are pushed to enforcers)? And that in high volume setups the Watcher might be more performant? Or is there some other benefit of Watchers that I am missing?

    231 次点击  ∙  1 人收藏  
      Tweet Weibo 忽略主题 
    2 条回复   2021-09-05 15:49:57 +08:00
    hsluoyz
    hsluoyz4年前

    @SiggiSmara hi, plz send github issue

    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   40 人在线   最高记录 40   ·     选择语言  ·     选择编辑器
    创意工作者们的社区
    World is powered by code
    VERSION: 2c477f2 · 17ms · UTC 16:38 · PVG 00:38 · LAX 09:38 · JFK 12:38
    ♥ Do have faith in what you're doing.