Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/js/libs/redis/memo.redis.go
2070 views
1
// Warning - This is generated code
2
package redis
3
4
import (
5
"errors"
6
"fmt"
7
8
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
9
)
10
11
func memoizedgetServerInfo(executionId string, host string, port int) (string, error) {
12
hash := "getServerInfo" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
13
14
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
15
return getServerInfo(executionId, host, port)
16
})
17
if err != nil {
18
return "", err
19
}
20
if value, ok := v.(string); ok {
21
return value, nil
22
}
23
24
return "", errors.New("could not convert cached result")
25
}
26
27
func memoizedconnect(executionId string, host string, port int, password string) (bool, error) {
28
hash := "connect" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(password)
29
30
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
31
return connect(executionId, host, port, password)
32
})
33
if err != nil {
34
return false, err
35
}
36
if value, ok := v.(bool); ok {
37
return value, nil
38
}
39
40
return false, errors.New("could not convert cached result")
41
}
42
43
func memoizedgetServerInfoAuth(executionId string, host string, port int, password string) (string, error) {
44
hash := "getServerInfoAuth" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port) + ":" + fmt.Sprint(password)
45
46
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
47
return getServerInfoAuth(executionId, host, port, password)
48
})
49
if err != nil {
50
return "", err
51
}
52
if value, ok := v.(string); ok {
53
return value, nil
54
}
55
56
return "", errors.New("could not convert cached result")
57
}
58
59
func memoizedisAuthenticated(executionId string, host string, port int) (bool, error) {
60
hash := "isAuthenticated" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
61
62
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
63
return isAuthenticated(executionId, host, port)
64
})
65
if err != nil {
66
return false, err
67
}
68
if value, ok := v.(bool); ok {
69
return value, nil
70
}
71
72
return false, errors.New("could not convert cached result")
73
}
74
75