| 188 | // Apply a LRU memoization cache to a callable. |
| 189 | template <typename Func> |
| 190 | static auto MemoizeLru(Func&& func, int32_t cache_capacity) |
| 191 | -> decltype(detail::Memoize<LruCache, detail::ThreadSafeMemoizer>( |
| 192 | std::forward<Func>(func), cache_capacity)) { |
| 193 | return detail::Memoize<LruCache, detail::ThreadSafeMemoizer>(std::forward<Func>(func), |
| 194 | cache_capacity); |
| 195 | } |
| 196 | |
| 197 | // Like MemoizeLru, but not thread-safe. This version allows for much faster |
| 198 | // lookups (more than 2x faster), but you'll have to manage thread safety yourself. |
no outgoing calls