| 193 | |
| 194 | template<Cache::EvictionPolicy policy> |
| 195 | Status RLCacheShard<policy>::Init() { |
| 196 | if (!MathLimits<double>::IsFinite(FLAGS_cache_memtracker_approximation_ratio) || |
| 197 | FLAGS_cache_memtracker_approximation_ratio < 0.0 || |
| 198 | FLAGS_cache_memtracker_approximation_ratio > 1.0) { |
| 199 | return Status(Substitute("Misconfigured --cache_memtracker_approximation_ratio: $0. " |
| 200 | "Must be between 0 and 1.", FLAGS_cache_memtracker_approximation_ratio)); |
| 201 | } |
| 202 | max_deferred_consumption_ = capacity_ * FLAGS_cache_memtracker_approximation_ratio; |
| 203 | initialized_ = true; |
| 204 | return Status::OK(); |
| 205 | } |
| 206 | |
| 207 | template<Cache::EvictionPolicy policy> |
| 208 | bool RLCacheShard<policy>::Unref(RLHandle* e) { |