Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // RedisURL is used to establish a Redis connection (default: "redis://127.0.0.1:6379") RedisURL string // Cluster tells whether to use a Redis Cluster client or not (default: false) Cluster bool // Channel is the Redis channel for pub/sub (default: "/casbin") Channel string // LocalID is the identifier used for avoiding unnecessary updates (default is an auto-generated UUID) LocalID string // NewClient is the function used to create a new redis.UniversalClient (optional) NewClient func() (redis.UniversalClient, error) }
Options are used to configure the Watcher
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher implements Casbin's persist.Watcher using Redis as a backend
func (*Watcher) Close ¶
func (w *Watcher) Close()
Close stops and releases the watcher, the callback function will not be called any more.
func (*Watcher) SetUpdateCallback ¶
SetUpdateCallback sets the callback function that the watcher will call when the policy in DB has been changed by other instances. A classic callback is Enforcer.LoadPolicy().
Click to show internal directories.
Click to hide internal directories.