Len 读取当前缓存数量
()
| 116 | |
| 117 | // Len 读取当前缓存数量 |
| 118 | func (this *UserAgentParser) Len() int { |
| 119 | var total = 0 |
| 120 | for i := 0; i < userAgentShardingCount; i++ { |
| 121 | this.mu.RLock(i) |
| 122 | total += len(this.cacheMaps[i]) |
| 123 | this.mu.RUnlock(i) |
| 124 | } |
| 125 | return total |
| 126 | } |
| 127 | |
| 128 | // GC 回收多余的缓存 |
| 129 | func (this *UserAgentParser) GC() { |