本文整理匯總了Golang中github.com/elastic/beats/libbeat/common.NewCache函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewCache函數的具體用法?Golang NewCache怎麽用?Golang NewCache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewCache函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
func (mongodb *Mongodb) init(results publish.Transactions, config *mongodbConfig) error {
debugf("Init a MongoDB protocol parser")
mongodb.setFromConfig(config)
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
}
示例2: init
func (thrift *thriftPlugin) init(
testMode bool,
results publish.Transactions,
config *thriftConfig,
) error {
thrift.InitDefaults()
err := thrift.readConfig(config)
if err != nil {
return err
}
thrift.transactions = common.NewCache(
thrift.transactionTimeout,
protos.DefaultTransactionHashSize)
thrift.transactions.StartJanitor(thrift.transactionTimeout)
if !testMode {
thrift.publishQueue = make(chan *thriftTransaction, 1000)
thrift.results = results
go thrift.publishTransactions()
}
return nil
}
示例3: init
func (rpc *Rpc) init(results publish.Transactions, config *rpcConfig) error {
rpc.setFromConfig(config)
rpc.results = results
rpc.callsSeen = common.NewCache(rpc.transactionTimeout,
protos.DefaultTransactionHashSize)
rpc.callsSeen.StartJanitor(rpc.transactionTimeout)
return nil
}
示例4: init
func (pgsql *Pgsql) init(results publish.Transactions, config *pgsqlConfig) error {
pgsql.setFromConfig(config)
pgsql.transactions = common.NewCache(
pgsql.transactionTimeout,
protos.DefaultTransactionHashSize)
pgsql.transactions.StartJanitor(pgsql.transactionTimeout)
pgsql.handlePgsql = handlePgsql
pgsql.results = results
return nil
}
示例5: init
func (mysql *Mysql) init(results publish.Transactions, config *mysqlConfig) error {
mysql.setFromConfig(config)
mysql.transactions = common.NewCache(
mysql.transactionTimeout,
protos.DefaultTransactionHashSize)
mysql.transactions.StartJanitor(mysql.transactionTimeout)
mysql.handleMysql = handleMysql
mysql.results = results
return nil
}
示例6: init
func (amqp *Amqp) init(results publish.Transactions, config *amqpConfig) error {
amqp.initMethodMap()
amqp.setFromConfig(config)
if amqp.HideConnectionInformation == false {
amqp.addConnectionMethods()
}
amqp.transactions = common.NewCache(
amqp.transactionTimeout,
protos.DefaultTransactionHashSize)
amqp.transactions.StartJanitor(amqp.transactionTimeout)
amqp.results = results
return nil
}
示例7: Init
func (mongodb *Mongodb) Init(test_mode bool, results publish.Transactions) 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
}
示例8: 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
}
示例9: 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
}
示例10: Init
func (pgsql *Pgsql) Init(test_mode bool, results publisher.Client) error {
pgsql.InitDefaults()
if !test_mode {
err := pgsql.setFromConfig(config.ConfigSingleton.Protocols.Pgsql)
if err != nil {
return err
}
}
pgsql.transactions = common.NewCache(
pgsql.transactionTimeout,
protos.DefaultTransactionHashSize)
pgsql.transactions.StartJanitor(pgsql.transactionTimeout)
pgsql.handlePgsql = handlePgsql
pgsql.results = results
return nil
}
示例11: Init
func (mysql *Mysql) Init(test_mode bool, results publish.Transactions) 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
}
示例12: NewTCP
// Creates and returns a new Tcp.
func NewTCP(p protos.Protocols) (*TCP, error) {
isDebug = logp.IsDebug("tcp")
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)
if isDebug {
debugf("tcp", "Port map: %v", portMap)
}
return tcp, nil
}
示例13: Init
func (thrift *Thrift) Init(test_mode bool, results publish.Transactions) error {
thrift.InitDefaults()
if !test_mode {
err := thrift.readConfig(config.ConfigSingleton.Protocols.Thrift)
if err != nil {
return err
}
}
thrift.transactions = common.NewCache(
thrift.transactionTimeout,
protos.DefaultTransactionHashSize)
thrift.transactions.StartJanitor(thrift.transactionTimeout)
if !test_mode {
thrift.PublishQueue = make(chan *ThriftTransaction, 1000)
thrift.results = results
go thrift.publishTransactions()
}
return nil
}