public long?GetExpiresAfter(K key) { policy.RequireNonNull <K>(key); K lookupKey = policy.cache.nodeFactory.NewLookupKey(key); Node <K, V> node = policy.cache.data[lookupKey]; if (node == null) { return(null); } long duration = node.VariableTime - policy.cache.ExpirationTicker.Ticks(); return((duration <= 0) ? null : (long?)duration); }
public long?AgeOf(K key) { policy.RequireNonNull <K>(key); K lookupKey = policy.cache.nodeFactory.NewLookupKey(key); Node <K, V> node = policy.cache.data[key]; if (node == null) { return(null); } long age = policy.cache.ExpirationTicker.Ticks() - node.WriteTime; return((age > policy.cache.ExpiresAfterWriteNanos) ? new long?() : age); }
public int?WeightOf(K key) { policy.RequireNonNull <K>(key); if (!IsWeighted) { return(null); } Node <K, V> node = null; policy.cache.data.TryGetValue(policy.cache.nodeFactory.NewLookupKey(key), out node); if (node == null) { return(null); } lock (node) { return(node.Weight); } }