-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51afa06
commit cef4ae1
Showing
13 changed files
with
350 additions
and
1 deletion.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...ing.Abstractions/ref/Microsoft.Extensions.Caching.Abstractions.Typeforwards.netcoreapp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// The compiler emits a reference to the internal copy of this type in our non-NETCoreApp assembly | ||
// so we must include a forward to be compatible with libraries compiled against non-NETCoreApp Microsoft.Extensions.Caching.Abstractions | ||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...t.Extensions.Caching.Abstractions/ref/Microsoft.Extensions.Caching.Abstractions.net6.0.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// ------------------------------------------------------------------------------ | ||
// Changes to this file must follow the https://aka.ms/api-review process. | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace Microsoft.Extensions.Caching.Memory | ||
{ | ||
public partial interface IMemoryCache : System.IDisposable | ||
{ | ||
MemoryCacheStatistics? GetCurrentStatistics() => null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/libraries/Microsoft.Extensions.Caching.Abstractions/src/MemoryCacheStatistics.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Microsoft.Extensions.Caching.Memory | ||
{ | ||
/// <summary> | ||
/// Holds a snapshot of statistics for a memory cache. | ||
/// </summary> | ||
public class MemoryCacheStatistics | ||
{ | ||
/// <summary> | ||
/// Initializes an instance of MemoryCacheStatistics. | ||
/// </summary> | ||
public MemoryCacheStatistics() { } | ||
|
||
/// <summary> | ||
/// Gets the number of <see cref="ICacheEntry" /> instances currently in the memory cache. | ||
/// </summary> | ||
public long CurrentEntryCount { get; init; } | ||
|
||
/// <summary> | ||
/// Gets an estimated sum of all the <see cref="ICacheEntry.Size" /> values currently in the memory cache. | ||
/// </summary> | ||
/// <returns>Returns <see langword="null"/> if size isn't being tracked. The common MemoryCache implementation tracks size whenever a SizeLimit is set on the cache.</returns> | ||
public long? CurrentEstimatedSize { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the total number of cache misses. | ||
/// </summary> | ||
public long TotalMisses { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the total number of cache hits. | ||
/// </summary> | ||
public long TotalHits { get; init; } | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...ing.Abstractions/src/Microsoft.Extensions.Caching.Abstractions.Typeforwards.netcoreapp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// The compiler emits a reference to the internal copy of this type in our non-NETCoreApp assembly | ||
// so we must include a forward to be compatible with libraries compiled against non-NETCoreApp Microsoft.Extensions.Caching.Abstractions | ||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Hello @maryamariyan,
I was reviewing the source code for memory caching statistics when I came across something unexpected. I couldn't quite understand why the
IntPtr.Size == 4
(32-bit platform check) is necessary.Would you be able to provide more details? Thank you in advance.