Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

MemCache: Initial API structure. #2

Merged
merged 1 commit into from
Aug 27, 2014
Merged

MemCache: Initial API structure. #2

merged 1 commit into from
Aug 27, 2014

Conversation

Tratcher
Copy link
Member

@Tratcher Tratcher commented Aug 6, 2014


namespace Microsoft.AspNet.MemoryCache
{
public interface IMemoryCache : IEnumerable<KeyValuePair<string, object>>, IDisposable
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AssemblyNeutral]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend not having the cache itself be enumerable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: have an API that can get a cache dependency object for a given (key, value) entry. This would allow creating custom dependency chains where entries in a given memory cache can be dependent on entries in an arbitrary other memory cache.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 - what is the concept name of a cache dependency object? ICacheDependency? IMemoryCacheToken? IDependencyToken?

To be honest the object name dependency always seemed like an odd fit for an expiration trigger.

@Tratcher
Copy link
Member Author

Tratcher commented Aug 8, 2014

Updated. I've added some usage samples that may be a better way to discuss scenarios.

@Tratcher
Copy link
Member Author

Updated.

public enum EvictionReason
{
None,
// Manually
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should turn these into doc comments. We'll need them eventually anyway.

@Tratcher
Copy link
Member Author

Squashed. Last call for comments.

{
public void Main()
{
IMemoryCache cache = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering where do you instantiate this cache variable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't an implementation available yet. This sample is just for demonstration purposes, it won't actually run.

@Tratcher Tratcher merged commit 20e4656 into dev Aug 27, 2014
@Tratcher Tratcher deleted the APIs branch August 27, 2014 16:11
{
// TODO: Granularity?
/// <summary>
/// Specifies how items are prioritized for presurvation during a memory pressure triggered cleanup.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late to the party, but typo in presurvation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants