Documentation ¶
Index ¶
- Variables
- func MakeInMemory(settings interface{}) (services.Database, error)
- func MakeRedisAsDatabase(settings interface{}) (services.Database, error)
- func MakeRedisClient(settings interface{}) (redis.UniversalClient, uint32, error)
- func MakeRedisShardAsDatabase(settings interface{}) (services.Database, error)
- func ValidateInMemorySettings(settings map[string]interface{}) (interface{}, error)
- func ValidateRedisSettings(settings map[string]interface{}) (interface{}, error)
- func ValidateRedisShardSettings(settings map[string]interface{}) (interface{}, error)
- type InMemory
- func (d *InMemory) Close() error
- func (d *InMemory) Expire(table string, key []byte, ttl time.Duration) error
- func (d *InMemory) List(table string, key []byte) services.List
- func (d *InMemory) Lock(lockKey string) (services.Lock, error)
- func (d *InMemory) Map(table string, key []byte) services.Map
- func (d *InMemory) Open() error
- func (d *InMemory) Reset() error
- func (d *InMemory) Set(table string, key []byte) services.Set
- func (d *InMemory) SortedSet(table string, key []byte) services.SortedSet
- func (d *InMemory) Value(table string, key []byte) services.Value
- type InMemorySettings
- type MetricHook
- func (m MetricHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (m MetricHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (m MetricHook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (m MetricHook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- type Redis
- func (d *Redis) Client(key string) redis.UniversalClient
- func (d *Redis) Close() error
- func (d *Redis) Expire(table string, key []byte, ttl time.Duration) error
- func (d *Redis) List(table string, key []byte) services.List
- func (d *Redis) Lock(lockKey string) (services.Lock, error)
- func (d *Redis) Map(table string, key []byte) services.Map
- func (d *Redis) Open() error
- func (d *Redis) Reset() error
- func (d *Redis) Set(table string, key []byte) services.Set
- func (d *Redis) SortedSet(table string, key []byte) services.SortedSet
- func (d *Redis) Value(table string, key []byte) services.Value
- type RedisLock
- type RedisMap
- type RedisSet
- type RedisSettings
- type RedisShardSettings
- type RedisSortedSet
- func (r *RedisSortedSet) Add(data []byte, score int64) error
- func (r *RedisSortedSet) At(index int64) (*services.SortedSetEntry, error)
- func (r *RedisSortedSet) Del(data []byte) (bool, error)
- func (r *RedisSortedSet) PopMin(n int64) ([]*services.SortedSetEntry, error)
- func (r *RedisSortedSet) Range(from, to int64) ([]*services.SortedSetEntry, error)
- func (r *RedisSortedSet) RangeByScore(from, to int64) ([]*services.SortedSetEntry, error)
- func (r *RedisSortedSet) RemoveRangeByScore(from, to int64) error
- func (r *RedisSortedSet) Score(data []byte) (int64, error)
- type RedisValue
- type TTL
Constants ¶
This section is empty.
Variables ¶
View Source
var Databases = services.DatabaseDefinitions{ "redis": services.DatabaseDefinition{ Name: "Redis Database", Description: "For Production Use", Maker: MakeRedisAsDatabase, SettingsValidator: ValidateRedisSettings, }, "redis-shard": services.DatabaseDefinition{ Name: "Redis Sharded Database", Description: "For Production Use", Maker: MakeRedisShardAsDatabase, SettingsValidator: ValidateRedisShardSettings, }, "in-memory": services.DatabaseDefinition{ Name: "In-memory Database (no persistence! just use for testing)", Description: "An in-memory database for testing only", Maker: MakeInMemory, SettingsValidator: ValidateInMemorySettings, }, }
View Source
var NotFound = fmt.Errorf("not found")
View Source
var RedisForm = forms.Form{ ErrorMsg: "invalid data encountered in the Redis config form", Fields: []forms.Field{ { Name: "addresses", Validators: []forms.Validator{ forms.IsOptional{Default: []string{}}, forms.IsStringList{}, }, }, { Name: "sentinel_addresses", Validators: []forms.Validator{ forms.IsOptional{Default: []string{}}, forms.IsStringList{}, }, }, { Name: "master_name", Validators: []forms.Validator{ forms.IsOptional{Default: ""}, forms.IsString{}, }, }, { Name: "database", Validators: []forms.Validator{ forms.IsOptional{Default: 0}, forms.IsInteger{Min: 0, Max: 100}, }, }, { Name: "password", Validators: []forms.Validator{ forms.IsRequired{}, forms.IsString{}, }, }, { Name: "sentinel_username", Validators: []forms.Validator{ forms.IsOptional{}, forms.IsString{}, }, }, { Name: "sentinel_password", Validators: []forms.Validator{ forms.IsOptional{}, forms.IsString{}, }, }, { Name: "shard_index", Validators: []forms.Validator{ forms.IsOptional{Default: 0}, forms.IsInteger{}, }, }, }, }
Functions ¶
func MakeInMemory ¶
func MakeRedisAsDatabase ¶ added in v0.0.4
func MakeRedisClient ¶ added in v0.0.4
func MakeRedisShardAsDatabase ¶ added in v0.0.4
func ValidateRedisSettings ¶
func ValidateRedisShardSettings ¶ added in v0.0.4
Types ¶
type InMemorySettings ¶
type InMemorySettings struct { }
type MetricHook ¶
type MetricHook struct {
// contains filtered or unexported fields
}
func (MetricHook) AfterProcess ¶
func (m MetricHook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
func (MetricHook) AfterProcessPipeline ¶
func (m MetricHook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
func (MetricHook) BeforeProcess ¶
func (MetricHook) BeforeProcessPipeline ¶
type Redis ¶
func MakeRedisShards ¶ added in v0.0.4
type RedisLock ¶
type RedisLock struct {
// contains filtered or unexported fields
}
func MakeRedisLock ¶
type RedisSettings ¶
type RedisSettings struct { MasterName string `json:"master_name"` Addresses []string `json:"addresses` SentinelAddresses []string `json:"sentinel_addresses` Database int64 `json:"database"` Password string `json:"password"` SentinelUsername string `json:"sentinel_username"` SentinelPassword string `json:"sentinel_password"` ShardIndex int64 `json:"shard_index"` }
type RedisShardSettings ¶ added in v0.0.4
type RedisShardSettings struct {
Shards []RedisSettings `json:"shards"`
}
type RedisSortedSet ¶
type RedisSortedSet struct {
// contains filtered or unexported fields
}
func (*RedisSortedSet) At ¶
func (r *RedisSortedSet) At(index int64) (*services.SortedSetEntry, error)
func (*RedisSortedSet) PopMin ¶
func (r *RedisSortedSet) PopMin(n int64) ([]*services.SortedSetEntry, error)
func (*RedisSortedSet) Range ¶
func (r *RedisSortedSet) Range(from, to int64) ([]*services.SortedSetEntry, error)
func (*RedisSortedSet) RangeByScore ¶
func (r *RedisSortedSet) RangeByScore(from, to int64) ([]*services.SortedSetEntry, error)
func (*RedisSortedSet) RemoveRangeByScore ¶
func (r *RedisSortedSet) RemoveRangeByScore(from, to int64) error
type RedisValue ¶
type RedisValue struct {
// contains filtered or unexported fields
}
func (*RedisValue) Del ¶
func (r *RedisValue) Del() error
func (*RedisValue) Get ¶
func (r *RedisValue) Get() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.