Swift 的 LRU 缓存 SwiftlyLRU
- 授权协议: MIT
- 开发语言: Swift
- 操作系统: iOS
- 软件首页: https://github.com/justinmfischer/SwiftlyLRU
软件介绍
//// Example//import Foundation//...//Create cache with capacityvar cache = SwiftlyLRU<String, Float>(capacity: 7) //Add Key, Value pairs
cache["AAPL"] = 114.63
cache["GOOG"] = 533.75
cache["YHOO"] = 50.67
cache["TWTR"] = 38.91
cache["BABA"] = 109.89
cache["YELP"] = 55.17
cache["BABA"] = 109.80
cache["TSLA"] = 231.43
cache["AAPL"] = 113.41
cache["GOOG"] = 533.60
cache["AAPL"] = 113.01
//Retrieve
if let item = cache["AAPL"] {
println("Key: AAPL Value: \(item)")
} else {
println("Item not found.")
}/* OUTPUT Key: AAPL Value: 113.01*/
//Describe
println(cache)/* OUTPUT SwiftlyLRU Cache(7) Key: AAPL Value: Optional(113.01) Key: GOOG Value: Optional(533.6) Key: TSLA Value: Optional(231.43) Key: BABA Value: Optional(109.8) Key: YELP Value: Optional(55.17) Key: TWTR Value: Optional(38.91) Key: YHOO Value: Optional(50.67) *///...APIs
Daniel Jacobson、Greg Brail、Dan Woods / O'Reilly Media / 2011-12-24 / USD 24.99
Many of the highest traffic sites get more than half of their traffic not through the browser but through the APIs they have created. Salesforce.com (more than 50%) and Twitter (more than 75% fall int......一起来看看 《APIs》 这本书的介绍吧!
