当前位置: 首页>>代码示例>>Golang>>正文


Golang LRUCache.Capacity方法代码示例

本文整理汇总了Golang中tools/cache.LRUCache.Capacity方法的典型用法代码示例。如果您正苦于以下问题:Golang LRUCache.Capacity方法的具体用法?Golang LRUCache.Capacity怎么用?Golang LRUCache.Capacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tools/cache.LRUCache的用法示例。


在下文中一共展示了LRUCache.Capacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Settings

// Function serialize sub command of stats "settings"
func (s *ServerStat) Settings(storage *cache.LRUCache) map[string]string {
	dict := make(map[string]string)
	dict["maxbytes"] = tools.IntToString(storage.Capacity())
	dict["maxconns"] = tools.IntToString(int64(s.Connections_limit))
	dict["tcpport"] = s.tcp
	dict["udpport"] = s.udp
	dict["verbosity"] = tools.IntToString(int64(s.verbosity))
	dict["num_goroutines"] = tools.IntToString(int64(runtime.NumGoroutine()))
	dict["evictions"] = "on" //TODO: to think about apportunity of another value.
	if storage.Crawler.Enabled() {
		dict["lru_crawler"] = "true"
	} else {
		dict["lru_crawler"] = "false"
	}
	dict["lru_crawler_sleep"] = tools.IntToString(int64(storage.Crawler.Sleep()))
	dict["lru_crawler_tocrawl"] = tools.IntToString(int64(storage.Crawler.ItemsPerRun))
	if s.cas_disabled {
		dict["cas_enabled"] = "false"
	} else {
		dict["cas_enabled"] = "true"
	}
	if s.flush_disabled {
		dict["flush_all_enabled"] = "false"
	} else {
		dict["flush_all_enabled"] = "true"
	}
	return dict
}
开发者ID:UIKit0,项目名称:memorango,代码行数:29,代码来源:stat.go

示例2: Serialize

// Function serialize statistic of server and storage and returns it as map of strings
func (s *ServerStat) Serialize(storage *cache.LRUCache) map[string]string {
	dict := make(map[string]string)
	dict["pid"] = tools.IntToString(int64(s.pid))
	dict["uptime"] = tools.IntToString(int64(s.uptime()))
	dict["time"] = tools.IntToString(int64(s.time()))
	dict["version"] = tools.VERSION
	dict["pointer_size"] = tools.IntToString(int64(pointer_size))
	secu, mcsecu, secs, mcsecs := s.rusage()
	dict["rusage_user"] = tools.IntToString(secu) + "." + tools.IntToString(mcsecu)
	dict["rusage_system"] = tools.IntToString(secs) + "." + tools.IntToString(mcsecs)
	dict["curr_items"] = tools.IntToString(int64(storage.Stats.Current_items))
	dict["total_items"] = tools.IntToString(int64(storage.Stats.Total_items))
	dict["bytes"] = tools.IntToString(s.bytes(storage.Capacity()))
	dict["curr_connections"] = tools.IntToString(int64(s.Current_connections))
	dict["total_connections"] = tools.IntToString(int64(s.Total_connections))
	dict["evictions"] = tools.IntToString(int64(storage.Stats.Evictions))
	dict["expired_unfetched"] = tools.IntToString(int64(storage.Stats.Expired_unfetched))
	dict["evicted_unfetched"] = tools.IntToString(int64(storage.Stats.Evicted_unfetched))
	dict["bytes_read"] = tools.IntToString(int64(s.Read_bytes))
	dict["bytes_written"] = tools.IntToString(int64(s.Written_bytes))
	dict["goroutines"] = tools.IntToString(int64(runtime.NumGoroutine()))
	dict["crawler_reclaimed"] = tools.IntToString(storage.Stats.Crawler_reclaimed)
	for key, value := range s.Commands {
		dict[key] = tools.IntToString(int64(value))
	}
	return dict
}
开发者ID:UIKit0,项目名称:memorango,代码行数:28,代码来源:stat.go


注:本文中的tools/cache.LRUCache.Capacity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。