generateCacheKey 生成缓存键
(userID, resource, action string, context map[string]any)
| 978 | |
| 979 | // generateCacheKey 生成缓存键 |
| 980 | func (ac *AccessController) generateCacheKey(userID, resource, action string, context map[string]any) string { |
| 981 | data := fmt.Sprintf("%s:%s:%s:%v", userID, resource, action, context) |
| 982 | hash := sha256.Sum256([]byte(data)) |
| 983 | return hex.EncodeToString(hash[:]) |
| 984 | } |
| 985 | |
| 986 | // startCleanupWorker 启动清理工作协程 |
| 987 | func (ac *AccessController) startCleanupWorker() { |