1 Star 1 Fork 0

Gousing/cache

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
types.go 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
package storage
import "time"
// StorageType 缓存实例类型
// - 0 => 未知或无效的驱动库
// - 1 => MemoryCache 缓存实例
// - 2 => RedisCache 缓存实例
// - 3 => L2Cache Local+Remote 二级缓存实例, 通常为 MemoryCache + RedisCache 驱动组合模式
type StorageType uint8
const (
StorageInvalid StorageType = iota // 0 => 未知或无效的缓存实例
StorageMemory // 1 => MemoryCache 缓存实例
StorageRedis // 2 => RedisCache 缓存实例
StorageL2Cache // 3 => L2Cache Local+Remote 二级缓存实例, 通常为 MemoryCache + RedisCache 驱动组合模式
)
func (t StorageType) String() string {
switch t {
case StorageMemory:
return "Storage Memory"
case StorageRedis:
return "Storage Redis"
case StorageL2Cache:
return "Storage L2Cache"
default:
return "Storage Invalid"
}
}
// LiveState 缓存实例的运行状态枚举值
// - 0 => 关闭状态
// - 1 => 正常状态
// - 2 => 异常状态
type LiveState int8
const (
LiveStateShutdown LiveState = iota // 0 关闭状态
LiveStateNormal // 1 正常状态
LiveStateFailure // 2 异常状态
)
type TypeBase interface {
string | bool | TypeNumber | TypeTime
}
type TypeBaseSlice interface {
[]string | []bool |
[]int | []int8 | []int16 | []int32 | []int64 |
[]uint | []uint8 | []uint16 | []uint32 | []uint64 |
[]float32 | []float64 |
[]time.Time | []time.Duration | []time.Month | []time.Weekday
}
type TypeNumber interface {
TypeInt | TypeUint | TypeFloat
}
type TypeInt interface {
int | int8 | int16 | int32 | int64 // rune => int32
}
type TypeUint interface {
uint | uint8 | uint16 | uint32 | uint64 // byte => uint8 uintptr => uint32/uint64
}
type TypeFloat interface {
float32 | float64
}
type TypeTime interface {
time.Time | time.Duration | time.Month | time.Weekday
}
type TypeSliceAny []any
type TypeSliceBase[T TypeBase] []T
type TypeMapBaseAny[K TypeBase] map[K]any
type TypeMapComparableAny[K comparable] map[K]any
type TypeMapBaseAs[K TypeBase, V TypeBase] map[K]V
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/gousing/cache.git
git@gitee.com:gousing/cache.git
gousing
cache
cache
v1.2.3

搜索帮助