MCPcopy Create free account
hub / github.com/astercloud/aster / generateCacheKey

Method generateCacheKey

pkg/security/access_control.go:980–984  ·  view source on GitHub ↗

generateCacheKey 生成缓存键

(userID, resource, action string, context map[string]any)

Source from the content-addressed store, hash-verified

978
979// generateCacheKey 生成缓存键
980func (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 启动清理工作协程
987func (ac *AccessController) startCleanupWorker() {

Callers 1

CheckPermissionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected