Skip to content

Commit

Permalink
rem delayable
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Peck committed Jun 8, 2024
1 parent 3b30b74 commit ac459e7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion BitFaster.Caching/Lfu/ConcurrentLfuCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private bool TryGetImpl(K key, [MaybeNullWhen(false)] out V value)
{
bool delayable = this.readBuffer.TryAdd(node) != BufferStatus.Full;

if (this.drainStatus.ShouldDrain(policy.IsReadDrainDelayable() && delayable))
if (this.drainStatus.ShouldDrain(delayable))
{
TryScheduleDrain();
}
Expand Down
7 changes: 0 additions & 7 deletions BitFaster.Caching/Lfu/NodePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal interface INodePolicy<K, V, N>
void AfterWrite(N node);
void OnEvict(N node);
void ExpireEntries<P>(ref ConcurrentLfuCore<K, V, N, P> cache) where P : struct, INodePolicy<K, V, N>;
bool IsReadDrainDelayable();
}

internal struct AccessOrderPolicy<K, V> : INodePolicy<K, V, AccessOrderNode<K, V>>
Expand Down Expand Up @@ -63,9 +62,6 @@ public void OnEvict(AccessOrderNode<K, V> node)
public void ExpireEntries<P>(ref ConcurrentLfuCore<K, V, AccessOrderNode<K, V>, P> cache) where P : struct, INodePolicy<K, V, AccessOrderNode<K, V>>
{
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsReadDrainDelayable() => true;
}

internal struct ExpireAfterPolicy<K, V> : INodePolicy<K, V, TimeOrderNode<K, V>>
Expand Down Expand Up @@ -145,8 +141,5 @@ public void ExpireEntries<P>(ref ConcurrentLfuCore<K, V, TimeOrderNode<K, V>, P>
{
wheel.Advance(ref cache, Duration.SinceEpoch());
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsReadDrainDelayable() => false;
}
}

0 comments on commit ac459e7

Please sign in to comment.