Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion BitFaster.Caching.UnitTests/CacheEventProxyBaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;
using BitFaster.Caching.Synchronized;
using FluentAssertions;
using Xunit;
Expand Down
1 change: 0 additions & 1 deletion BitFaster.Caching.UnitTests/ScopedAsyncCacheTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;
using FluentAssertions;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion BitFaster.Caching.UnitTests/ScopedCacheTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;
using FluentAssertions;
using Xunit;

Expand Down
12 changes: 6 additions & 6 deletions BitFaster.Caching/CacheEventProxyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;

namespace BitFaster.Caching
{
public abstract class CacheEventProxyBase<K, TInner, TOuter> : ICacheEvents<K, TOuter>
{
private readonly ICacheEvents<K, TInner> events;
private event EventHandler<Lru.ItemRemovedEventArgs<K, TOuter>> itemRemovedProxy;

private event EventHandler<ItemRemovedEventArgs<K, TOuter>> itemRemovedProxy;

public CacheEventProxyBase(ICacheEvents<K, TInner> events)
{
Expand All @@ -19,19 +19,19 @@ public CacheEventProxyBase(ICacheEvents<K, TInner> events)

public bool IsEnabled => this.events.IsEnabled;

public event EventHandler<Lru.ItemRemovedEventArgs<K, TOuter>> ItemRemoved
public event EventHandler<ItemRemovedEventArgs<K, TOuter>> ItemRemoved
{
add { this.Register(value); }
remove { this.UnRegister(value); }
}

private void Register(EventHandler<Lru.ItemRemovedEventArgs<K, TOuter>> value)
private void Register(EventHandler<ItemRemovedEventArgs<K, TOuter>> value)
{
itemRemovedProxy += value;
events.ItemRemoved += OnItemRemoved;
}

private void UnRegister(EventHandler<Lru.ItemRemovedEventArgs<K, TOuter>> value)
private void UnRegister(EventHandler<ItemRemovedEventArgs<K, TOuter>> value)
{
this.itemRemovedProxy -= value;

Expand All @@ -41,7 +41,7 @@ private void UnRegister(EventHandler<Lru.ItemRemovedEventArgs<K, TOuter>> value)
}
}

private void OnItemRemoved(object sender, Lru.ItemRemovedEventArgs<K, TInner> args)
private void OnItemRemoved(object sender, ItemRemovedEventArgs<K, TInner> args)
{
itemRemovedProxy(sender, TranslateOnRemoved(args));
}
Expand Down
1 change: 0 additions & 1 deletion BitFaster.Caching/ICacheEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;

namespace BitFaster.Caching
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace BitFaster.Caching.Lru
namespace BitFaster.Caching
{
/// <summary>
/// Provides data for the ItemRemoved event.
Expand All @@ -21,9 +21,9 @@ public class ItemRemovedEventArgs<K, V> : EventArgs
/// <param name="reason">The reason the item was removed from the cache.</param>
public ItemRemovedEventArgs(K key, V value, ItemRemovedReason reason)
{
this.Key = key;
this.Value = value;
this.Reason = reason;
Key = key;
Value = value;
Reason = reason;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Text;
using System.Threading.Tasks;

namespace BitFaster.Caching.Lru
namespace BitFaster.Caching
{
/// <summary>
/// Specifies the reason an item was removed from the Cache.
Expand Down
3 changes: 1 addition & 2 deletions BitFaster.Caching/Synchronized/AtomicFactoryAsyncCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;

namespace BitFaster.Caching.Synchronized
{
Expand Down Expand Up @@ -86,7 +85,7 @@ public EventProxy(ICacheEvents<K, AsyncAtomicFactory<K, V>> inner)

protected override ItemRemovedEventArgs<K, V> TranslateOnRemoved(ItemRemovedEventArgs<K, AsyncAtomicFactory<K, V>> inner)
{
return new Lru.ItemRemovedEventArgs<K, V>(inner.Key, inner.Value.ValueIfCreated, inner.Reason);
return new ItemRemovedEventArgs<K, V>(inner.Key, inner.Value.ValueIfCreated, inner.Reason);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions BitFaster.Caching/Synchronized/AtomicFactoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;

namespace BitFaster.Caching.Synchronized
{
Expand Down Expand Up @@ -91,7 +90,7 @@ public EventProxy(ICacheEvents<K, AtomicFactory<K, V>> inner)

protected override ItemRemovedEventArgs<K, V> TranslateOnRemoved(ItemRemovedEventArgs<K, AtomicFactory<K, V>> inner)
{
return new Lru.ItemRemovedEventArgs<K, V>(inner.Key, inner.Value.ValueIfCreated, inner.Reason);
return new ItemRemovedEventArgs<K, V>(inner.Key, inner.Value.ValueIfCreated, inner.Reason);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;

namespace BitFaster.Caching.Synchronized
{
Expand Down Expand Up @@ -104,7 +103,7 @@ public EventProxy(ICacheEvents<K, ScopedAsyncAtomicFactory<K, V>> inner)

protected override ItemRemovedEventArgs<K, Scoped<V>> TranslateOnRemoved(ItemRemovedEventArgs<K, ScopedAsyncAtomicFactory<K, V>> inner)
{
return new Lru.ItemRemovedEventArgs<K, Scoped<V>>(inner.Key, inner.Value.ScopeIfCreated, inner.Reason);
return new ItemRemovedEventArgs<K, Scoped<V>>(inner.Key, inner.Value.ScopeIfCreated, inner.Reason);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions BitFaster.Caching/Synchronized/AtomicFactoryScopedCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using BitFaster.Caching.Lru;

namespace BitFaster.Caching.Synchronized
{
Expand Down Expand Up @@ -102,7 +101,7 @@ public EventProxy(ICacheEvents<K, ScopedAtomicFactory<K, V>> inner)

protected override ItemRemovedEventArgs<K, Scoped<V>> TranslateOnRemoved(ItemRemovedEventArgs<K, ScopedAtomicFactory<K, V>> inner)
{
return new Lru.ItemRemovedEventArgs<K, Scoped<V>>(inner.Key, inner.Value.ScopeIfCreated, inner.Reason);
return new ItemRemovedEventArgs<K, Scoped<V>>(inner.Key, inner.Value.ScopeIfCreated, inner.Reason);
}
}
}
Expand Down