Get the object for i if it exists, else return nullptr. If the object exists, its eviction order will NOT change as this is not a cache hit.
| 1995 | // Get the object for i if it exists, else return nullptr. |
| 1996 | // If the object exists, its eviction order will NOT change as this is not a cache hit. |
| 1997 | ObjectType* getIfExists(const IndexType& index) { |
| 1998 | auto i = cache.find(index); |
| 1999 | if (i != cache.end()) { |
| 2000 | ++i->second.hits; |
| 2001 | return &i->second.item; |
| 2002 | } |
| 2003 | return nullptr; |
| 2004 | } |
| 2005 | |
| 2006 | // If index is in cache and not on the prioritized eviction order list, move it there. |
| 2007 | void prioritizeEviction(const IndexType& index) { |
no test coverage detected