You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
423 B
19 lines
423 B
2 years ago
|
package cache
|
||
|
|
||
|
type Cache interface {
|
||
|
// Set 设置/添加一个缓存,如果 key 存在,用新值覆盖旧值
|
||
|
Set(key string, value any)
|
||
|
// Get 通过 key 获取一个缓存值
|
||
|
Get(Key string) any
|
||
|
// Del 通过 key 删除一个缓存值
|
||
|
Del(Key string)
|
||
|
// DelOldest 删除最“无用”的一个缓存值
|
||
|
DelOldest()
|
||
|
// Len 获取缓存已存在的记录数
|
||
|
Len() int
|
||
|
}
|
||
|
|
||
|
type Value interface {
|
||
|
Len() int
|
||
|
}
|