feat(base): 添加邮箱注册码功能及用户注册接口 - 在 `sessionManager` 中新增邮件注册码缓存管理实例和相关方法 - 实现生成、保存、验证、删除邮件注册码的逻辑 - 新增 `/reg` 和 `/email` 接口用于用户注册和发送验证码 - 引入 `golang-lru` 依赖以支持限流缓存功能 - 调整包导入顺序,优化代码结构 ```
25 lines
1.1 KiB
Go
25 lines
1.1 KiB
Go
// Copyright IBM Corp. 2014, 2025
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Package lru provides three different LRU caches of varying sophistication.
|
|
//
|
|
// Cache is a simple LRU cache. It is based on the LRU implementation in
|
|
// groupcache: https://github.com/golang/groupcache/tree/master/lru
|
|
//
|
|
// TwoQueueCache tracks frequently used and recently used entries separately.
|
|
// This avoids a burst of accesses from taking out frequently used entries, at
|
|
// the cost of about 2x computational overhead and some extra bookkeeping.
|
|
//
|
|
// ARCCache is an adaptive replacement cache. It tracks recent evictions as well
|
|
// as recent usage in both the frequent and recent caches. Its computational
|
|
// overhead is comparable to TwoQueueCache, but the memory overhead is linear
|
|
// with the size of the cache.
|
|
//
|
|
// ARC has been patented by IBM, so do not use it if that is problematic for
|
|
// your program. For this reason, it is in a separate go module contained within
|
|
// this repository.
|
|
//
|
|
// All caches in this package take locks while operating, and are therefore
|
|
// thread-safe for consumers.
|
|
package lru
|