| 
														
															@@ -4,7 +4,6 @@ import ( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"container/list" 
														 | 
														
														 | 
														
															 	"container/list" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"sync" 
														 | 
														
														 | 
														
															 	"sync" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"sync/atomic" 
														 | 
														
														 | 
														
															 	"sync/atomic" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	//"fmt" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ) 
														 | 
														
														 | 
														
															 ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // An AtomicInt is an int64 to be accessed atomically. 
														 | 
														
														 | 
														
															 // An AtomicInt is an int64 to be accessed atomically. 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -12,11 +11,11 @@ type AtomicInt int64 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // MemCache is an LRU cache. It is safe for concurrent access. 
														 | 
														
														 | 
														
															 // MemCache is an LRU cache. It is safe for concurrent access. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 type MemCache struct { 
														 | 
														
														 | 
														
															 type MemCache struct { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	hits, gets  AtomicInt 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	mutex       sync.RWMutex 
														 | 
														
														 | 
														
															 	mutex       sync.RWMutex 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	maxItemSize int 
														 | 
														
														 | 
														
															 	maxItemSize int 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	cacheList   *list.List 
														 | 
														
														 | 
														
															 	cacheList   *list.List 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	cache       map[interface{}]*list.Element 
														 | 
														
														 | 
														
															 	cache       map[interface{}]*list.Element 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	hits, gets  AtomicInt 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 type entry struct { 
														 | 
														
														 | 
														
															 type entry struct { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -31,6 +30,8 @@ func NewMemCache(maxItemSize int) *MemCache { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		maxItemSize: maxItemSize, 
														 | 
														
														 | 
														
															 		maxItemSize: maxItemSize, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		cacheList:   list.New(), 
														 | 
														
														 | 
														
															 		cacheList:   list.New(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		cache:       make(map[interface{}]*list.Element), 
														 | 
														
														 | 
														
															 		cache:       make(map[interface{}]*list.Element), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		hits:        0, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		gets:        0, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	} 
														 | 
														
														 | 
														
															 	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |