启动时清空redis
This commit is contained in:
parent
19ccac6357
commit
51177dd525
@ -114,3 +114,7 @@ func (this *Redis) ScriptExists(ctx context.Context, hashes ...string) *redis.Bo
|
|||||||
// func (this *Redis) ScriptLoad(ctx context.Context, script string) *redis.StringCmd {
|
// func (this *Redis) ScriptLoad(ctx context.Context, script string) *redis.StringCmd {
|
||||||
// return this.client.ScriptLoad(ctx, script)
|
// return this.client.ScriptLoad(ctx, script)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
func (this *Redis) FlushAll(ctx context.Context) *redis.StatusCmd {
|
||||||
|
return this.client.FlushAll(ctx)
|
||||||
|
}
|
||||||
|
@ -124,6 +124,8 @@ type (
|
|||||||
EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd
|
EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd
|
||||||
ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd
|
ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd
|
||||||
// ScriptLoad(ctx context.Context, script string) *redis.StringCmd
|
// ScriptLoad(ctx context.Context, script string) *redis.StringCmd
|
||||||
|
//
|
||||||
|
FlushAll(ctx context.Context) *redis.StatusCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
ISys interface {
|
ISys interface {
|
||||||
@ -489,3 +491,7 @@ func EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{
|
|||||||
func ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd {
|
func ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd {
|
||||||
return defsys.ScriptExists(ctx, hashes...)
|
return defsys.ScriptExists(ctx, hashes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FlushAll(ctx context.Context) *redis.StatusCmd {
|
||||||
|
return defsys.FlushAll(ctx)
|
||||||
|
}
|
||||||
|
@ -379,6 +379,10 @@ func (this *Redis) ScriptExists(ctx context.Context, hashes ...string) *redis.Bo
|
|||||||
return this.client.ScriptExists(ctx, hashes...)
|
return this.client.ScriptExists(ctx, hashes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Redis) FlushAll(ctx context.Context) *redis.StatusCmd {
|
||||||
|
return this.client.FlushAll(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
//Codec---------------------------------------------------------------------------------------------------------------------------------------
|
//Codec---------------------------------------------------------------------------------------------------------------------------------------
|
||||||
func (this *Redis) Marshal(v interface{}) ([]byte, error) {
|
func (this *Redis) Marshal(v interface{}) ([]byte, error) {
|
||||||
if this.options.Codec != nil {
|
if this.options.Codec != nil {
|
||||||
|
@ -111,3 +111,7 @@ func (this *Redis) ScriptExists(ctx context.Context, hashes ...string) *redis.Bo
|
|||||||
// func (this *Redis) ScriptLoad(ctx context.Context, script string) *redis.StringCmd {
|
// func (this *Redis) ScriptLoad(ctx context.Context, script string) *redis.StringCmd {
|
||||||
// return this.client.ScriptLoad(ctx, script)
|
// return this.client.ScriptLoad(ctx, script)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
func (this *Redis) FlushAll(ctx context.Context) *redis.StatusCmd {
|
||||||
|
return this.client.FlushAll(ctx)
|
||||||
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
import "time"
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ISys interface {
|
ISys interface {
|
||||||
@ -31,6 +34,8 @@ func OnInit(config map[string]interface{}, option ...Option) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
defsys, err = newSys(options)
|
defsys, err = newSys(options)
|
||||||
|
|
||||||
|
defsys.Local().Redis.GetClient().FlushAll(context.TODO())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user