Documentation
¶
Index ¶
- Constants
- func CategoriesKey(category string) string
- func CategoryKey(category string) string
- func GenerateKey(keys ...string) string
- func VersionItemKey(category string, version string, itemKey string) string
- func VersionKey(category string, version string) string
- type Operation
- type RedisClient
- func (c *RedisClient) AfterAllDestroy()
- func (c *RedisClient) CleanVersion(category string, version string) error
- func (c *RedisClient) ClientV9() *redis.Client
- func (c *RedisClient) Context() context.Context
- func (c *RedisClient) Create() error
- func (c *RedisClient) Del(category, version, itemKey string) (int64, error)
- func (c *RedisClient) Get(category, version, itemKey string) (string, error)
- func (c *RedisClient) GetJsonSerialize(category, version, itemKey string, value any) error
- func (c *RedisClient) GetVersion(category string) (string, error)
- func (c *RedisClient) GetVersions(category string) ([]string, error)
- func (c *RedisClient) Set(category, version, itemKey, value string, expiration time.Duration) (string, error)
- func (c *RedisClient) SetJsonSerialize(category, version, itemKey string, value any, expiration time.Duration) (string, error)
- func (c *RedisClient) SetVersion(category, version string) error
- type RedisConfig
- type VersionControl
Constants ¶
View Source
const ( //VersionControlChannelName Version Control Channel Name VersionControlChannelName = "version_control" //KeySplitChar Key Split Char KeySplitChar = ":" //CategoryPrefix Category Prefix CategoryPrefix = "CV" //CategoriesPrefix Categories Prefix CategoriesPrefix = "CVS" )
View Source
const RedisClientTypeID = "0ae35550-7e37-4afe-866e-b129099759b7"
RedisClientTypeID type id
Variables ¶
This section is empty.
Functions ¶
func VersionItemKey ¶
VersionItemKey use category,version,item key to generate key of redis
Types ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient redis client dot
func NewRedisClient ¶
func NewRedisClient(conf *RedisConfig) (*RedisClient, func(), error)
construct dot
func (*RedisClient) AfterAllDestroy ¶
func (c *RedisClient) AfterAllDestroy()
AfterAllDestroy after all destroy
func (*RedisClient) CleanVersion ¶
func (c *RedisClient) CleanVersion(category string, version string) error
CleanVersion del versions in key
func (*RedisClient) ClientV9 ¶
func (c *RedisClient) ClientV9() *redis.Client
ClientV9 return redis.Client
func (*RedisClient) Context ¶
func (c *RedisClient) Context() context.Context
func (*RedisClient) Del ¶
func (c *RedisClient) Del(category, version, itemKey string) (int64, error)
Del del key
func (*RedisClient) Get ¶
func (c *RedisClient) Get(category, version, itemKey string) (string, error)
Get get value
func (*RedisClient) GetJsonSerialize ¶
func (c *RedisClient) GetJsonSerialize(category, version, itemKey string, value any) error
Get get value
func (*RedisClient) GetVersion ¶
func (c *RedisClient) GetVersion(category string) (string, error)
GetVersion get current version by category, return version and error.
func (*RedisClient) GetVersions ¶
func (c *RedisClient) GetVersions(category string) ([]string, error)
GetVersions return versions (dictionary order)
func (*RedisClient) Set ¶
func (c *RedisClient) Set(category, version, itemKey, value string, expiration time.Duration) (string, error)
Set set value
func (*RedisClient) SetJsonSerialize ¶
func (c *RedisClient) SetJsonSerialize(category, version, itemKey string, value any, expiration time.Duration) (string, error)
Set set value
func (*RedisClient) SetVersion ¶
func (c *RedisClient) SetVersion(category, version string) error
SetVersion set version for category
type RedisConfig ¶
type RedisConfig struct {
Addr string `json:"addr" toml:"addr" yaml:"addr" mapstructure:"addr"`
KeepMaxVersionCount int64 `` //分类中版本的最大数据量
/* 127-byte string literal not displayed */
VersionFromRedis bool `json:"version_from_redis" toml:"version_from_redis" yaml:"version_from_redis" mapstructure:"version_from_redis"` //get version from redis or not
}
type VersionControl ¶
type VersionControl struct {
// Op indicates the operation of the update.
Op Operation `json:"op"`
Key string `json:"key"`
Version string `json:"version"`
}
VersionControl defines a version edit.
func (*VersionControl) Unmarshal ¶
func (c *VersionControl) Unmarshal(jsonStr string) (*VersionControl, error)
Unmarshal json string to VersionControl
Click to show internal directories.
Click to hide internal directories.