(key string)
| 35 | } |
| 36 | |
| 37 | func (c *schemaCache) get(key string) (any, bool) { |
| 38 | c.mu.RLock() |
| 39 | defer c.mu.RUnlock() |
| 40 | |
| 41 | entry, ok := c.entries[key] |
| 42 | if !ok { |
| 43 | return nil, false |
| 44 | } |
| 45 | |
| 46 | // 检查是否过期 |
| 47 | if time.Since(entry.timestamp) > c.ttl { |
| 48 | return nil, false |
| 49 | } |
| 50 | |
| 51 | return entry.data, true |
| 52 | } |
| 53 | |
| 54 | func (c *schemaCache) set(key string, value any) { |
| 55 | c.mu.Lock() |