(key string, decision *AccessDecision, ttl time.Duration)
| 1039 | } |
| 1040 | |
| 1041 | func (cache *AccessCache) set(key string, decision *AccessDecision, ttl time.Duration) { |
| 1042 | cache.mu.Lock() |
| 1043 | defer cache.mu.Unlock() |
| 1044 | |
| 1045 | cache.entries[key] = &CacheEntry{ |
| 1046 | decision: decision, |
| 1047 | expiredAt: time.Now().Add(ttl), |
| 1048 | createdAt: time.Now(), |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | // 辅助函数 |
| 1053 | func contains(slice []string, item string) bool { |
no test coverage detected