本文整理匯總了Golang中github.com/elastic/libbeat/common.NewCache函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewCache函數的具體用法?Golang NewCache怎麽用?Golang NewCache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewCache函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Init
func (redis *Redis) Init(test_mode bool, results publisher.Client) error {
redis.InitDefaults()
if !test_mode {
redis.setFromConfig(config.ConfigSingleton.Protocols.Redis)
}
redis.transactions = common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize)
redis.transactions.StartJanitor(protos.DefaultTransactionExpiration)
redis.results = results
return nil
}
示例2: Init
func (mongodb *Mongodb) Init(test_mode bool, results publisher.Client) error {
debugf("Init a MongoDB protocol parser")
mongodb.InitDefaults()
if !test_mode {
err := mongodb.setFromConfig(config.ConfigSingleton.Protocols.Mongodb)
if err != nil {
return err
}
}
mongodb.requests = common.NewCache(
mongodb.transactionTimeout,
protos.DefaultTransactionHashSize)
mongodb.requests.StartJanitor(mongodb.transactionTimeout)
mongodb.responses = common.NewCache(
mongodb.transactionTimeout,
protos.DefaultTransactionHashSize)
mongodb.responses.StartJanitor(mongodb.transactionTimeout)
mongodb.results = results
return nil
}
示例3: Init
func (dns *Dns) Init(test_mode bool, results chan common.MapStr) error {
dns.initDefaults()
if !test_mode {
dns.setFromConfig(config.ConfigSingleton.Protocols.Dns)
}
dns.transactions = common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize)
dns.transactions.StartJanitor(protos.DefaultTransactionExpiration)
dns.results = results
return nil
}
示例4: NewTcp
// Creates and returns a new Tcp.
func NewTcp(p protos.Protocols) (*Tcp, error) {
portMap, err := buildPortsMap(p.GetAllTcp())
if err != nil {
return nil, err
}
tcp := &Tcp{
protocols: p,
portMap: portMap,
streams: common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize),
}
tcp.streams.StartJanitor(protos.DefaultTransactionExpiration)
logp.Debug("tcp", "Port map: %v", portMap)
return tcp, nil
}
示例5: Init
func (http *Http) Init(test_mode bool, results publisher.Client) error {
http.InitDefaults()
if !test_mode {
err := http.SetFromConfig(config.ConfigSingleton.Protocols.Http)
if err != nil {
return err
}
}
http.transactions = common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize)
http.transactions.StartJanitor(protos.DefaultTransactionExpiration)
http.results = results
return nil
}
示例6: Init
func (mongodb *Mongodb) Init(test_mode bool, results chan common.MapStr) error {
logp.Debug("mongodb", "Init a MongoDB protocol parser")
mongodb.InitDefaults()
if !test_mode {
err := mongodb.setFromConfig(config.ConfigSingleton.Protocols.Mongodb)
if err != nil {
return err
}
}
mongodb.transactions = common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize)
mongodb.transactions.StartJanitor(protos.DefaultTransactionExpiration)
mongodb.results = results
return nil
}
示例7: Init
func (mysql *Mysql) Init(test_mode bool, results chan common.MapStr) error {
mysql.InitDefaults()
if !test_mode {
err := mysql.setFromConfig(config.ConfigSingleton.Protocols.Mysql)
if err != nil {
return err
}
}
mysql.transactions = common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize)
mysql.transactions.StartJanitor(protos.DefaultTransactionExpiration)
mysql.handleMysql = handleMysql
mysql.results = results
return nil
}
示例8: Init
// Init initializes the HTTP protocol analyser.
func (http *HTTP) Init(testMode bool, results publisher.Client) error {
http.initDefaults()
if !testMode {
err := http.setFromConfig(config.ConfigSingleton.Protocols.Http)
if err != nil {
return err
}
}
http.transactions = common.NewCache(
http.transactionTimeout,
protos.DefaultTransactionHashSize)
http.transactions.StartJanitor(http.transactionTimeout)
http.results = results
return nil
}
示例9: Init
func (mysql *Mysql) Init(test_mode bool, results publisher.Client) error {
mysql.InitDefaults()
if !test_mode {
err := mysql.setFromConfig(config.ConfigSingleton.Protocols.Mysql)
if err != nil {
return err
}
}
mysql.transactions = common.NewCache(
mysql.transactionTimeout,
protos.DefaultTransactionHashSize)
mysql.transactions.StartJanitor(mysql.transactionTimeout)
mysql.handleMysql = handleMysql
mysql.results = results
return nil
}
示例10: Init
func (thrift *Thrift) Init(test_mode bool, results publisher.Client) error {
thrift.InitDefaults()
if !test_mode {
err := thrift.readConfig(config.ConfigSingleton.Protocols.Thrift)
if err != nil {
return err
}
}
thrift.transactions = common.NewCache(protos.DefaultTransactionExpiration,
protos.DefaultTransactionHashSize)
thrift.transactions.StartJanitor(protos.DefaultTransactionExpiration)
if !test_mode {
thrift.PublishQueue = make(chan *ThriftTransaction, 1000)
thrift.results = results
go thrift.publishTransactions()
}
return nil
}