config

package
v0.0.8-20250724 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

config包:缓存配置管理 定义了所有缓存驱动的统一配置结构和常量定义

本包提供了缓存系统的配置管理功能,支持多种缓存驱动的配置参数 通过统一的配置结构,简化了不同缓存实现的配置管理

支持的缓存驱动: - Redis:分布式内存缓存,支持集群和持久化 - BadgerDB:高性能本地LSM树存储 - BuntDB:快速内存数据库,支持持久化

配置参数说明: - Driver:缓存驱动类型标识 - Path:本地存储路径(BadgerDB/BuntDB使用) - Host:服务器地址(Redis使用) - Port:服务器端口(Redis使用) - Password:认证密码(Redis使用) - DB:数据库编号(Redis使用)

使用示例:

cfg := config.Cache{
    Driver: config.CacheDriverRedis,
    Host:   "localhost",
    Port:   "6379",
}

作者: gophertool

Index

Constants

View Source
const (
	CacheDriverRedis  = "redis"
	CacheDriverBadger = "badger"
	CacheDriverBuntdb = "buntdb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Driver   string
	Path     string
	Host     string
	Port     string
	Password string
	DB       int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL