Stop 停止缓存策略
()
| 329 | |
| 330 | // Stop 停止缓存策略 |
| 331 | func (this *MemoryStorage) Stop() { |
| 332 | this.locker.Lock() |
| 333 | |
| 334 | this.valuesMap = map[uint64]*MemoryItem{} |
| 335 | this.writingKeyMap = map[string]zero.Zero{} |
| 336 | _ = this.list.Reset() |
| 337 | if this.purgeTicker != nil { |
| 338 | this.purgeTicker.Stop() |
| 339 | } |
| 340 | |
| 341 | if this.dirtyChan != nil { |
| 342 | close(this.dirtyChan) |
| 343 | } |
| 344 | |
| 345 | this.usedSize = 0 |
| 346 | this.totalDirtySize = 0 |
| 347 | |
| 348 | _ = this.list.Close() |
| 349 | |
| 350 | this.locker.Unlock() |
| 351 | |
| 352 | this.ignoreKeys.Reset() |
| 353 | |
| 354 | // 回收内存 |
| 355 | runtime.GC() |
| 356 | |
| 357 | remotelogs.Println("CACHE", "close memory storage '"+strconv.FormatInt(this.policy.Id, 10)+"'") |
| 358 | } |
| 359 | |
| 360 | // Policy 获取当前存储的Policy |
| 361 | func (this *MemoryStorage) Policy() *serverconfigs.HTTPCachePolicy { |