AccessCache 缓存方法
(key string)
| 1027 | |
| 1028 | // AccessCache 缓存方法 |
| 1029 | func (cache *AccessCache) get(key string) *CacheEntry { |
| 1030 | cache.mu.RLock() |
| 1031 | defer cache.mu.RUnlock() |
| 1032 | |
| 1033 | entry, exists := cache.entries[key] |
| 1034 | if !exists || time.Now().After(entry.expiredAt) { |
| 1035 | return nil |
| 1036 | } |
| 1037 | |
| 1038 | return entry |
| 1039 | } |
| 1040 | |
| 1041 | func (cache *AccessCache) set(key string, decision *AccessDecision, ttl time.Duration) { |
| 1042 | cache.mu.Lock() |