1
0
mirror of https://github.com/fumiama/go-registry.git synced 2026-06-21 19:13:19 +08:00

优化速度

This commit is contained in:
fumiama
2022-02-15 00:38:43 +08:00
parent 0bb4b0bd81
commit e7c05d8bc8
5 changed files with 97 additions and 40 deletions

24
reg.go
View File

@@ -68,11 +68,11 @@ func (r *Regedit) Get(key string) (string, error) {
if err != nil {
return "", err
}
ackbytes := ack.Decrypt(r.seq)
if ackbytes == nil {
err = ack.Decrypt(r.seq)
if err != nil {
return "", errors.New("decrypt ack error")
}
a := BytesToString(ackbytes)
a := BytesToString(ack.data)
r.seq++
if a == "erro" {
return "", errors.New("server ack error")
@@ -100,11 +100,11 @@ func (r *Regedit) Set(key, value string) error {
if err != nil {
return err
}
ackbytes := ack.Decrypt(r.seq)
if ackbytes == nil {
err = ack.Decrypt(r.seq)
if err != nil {
return errors.New("decrypt ack error")
}
a := BytesToString(ackbytes)
a := BytesToString(ack.data)
r.seq++
if a == "erro" {
return errors.New("server ack error")
@@ -119,11 +119,11 @@ func (r *Regedit) Set(key, value string) error {
if err != nil {
return err
}
ackbytes = ack.Decrypt(r.seq)
if ackbytes == nil {
err = ack.Decrypt(r.seq)
if err != nil {
return errors.New("decrypt ack error")
}
a = BytesToString(ackbytes)
a = BytesToString(ack.data)
r.seq++
if a == "erro" {
return errors.New("server ack error")
@@ -148,11 +148,11 @@ func (r *Regedit) Del(key string) error {
if err != nil {
return err
}
ackbytes := ack.Decrypt(r.seq)
if ackbytes == nil {
err = ack.Decrypt(r.seq)
if err != nil {
return errors.New("decrypt ack error")
}
a := BytesToString(ackbytes)
a := BytesToString(ack.data)
r.seq++
if a == "erro" {
return errors.New("server ack error")