This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LRUCache<T> { | |
init(capicity: Int) { | |
self.capicity = capicity | |
self.head.connectNext(tail) | |
} | |
func set(_ object: T, for key: AnyHashable) { | |
let newNode = LinkNode(object, key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
USAGE: | |
let a:TimeInterval = 10.minute // 600s | |
let b = 1.5.hour // 5400s | |
let now = 0.second.later | |
let t1: Date = 5.minite.later | |
let t2 = 5.minite.ago | |
let t3 = 1.day.ago |