Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -0,0 +1,83 @@
//
// CacheEntryCollection.cs
//
// Authors:
// Marcos Henrih (marcos.henrich@xamarin.com)
//
// Copyright 2014 Xamarin, Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Collections;
using System.Collections.Generic;
using System.Timers;
namespace System.Runtime.Caching
{
interface ICacheEntryHelper : IComparer<MemoryCacheEntry>
{
DateTime GetDateTime (MemoryCacheEntry entry);
}
class CacheEntryCollection
{
protected MemoryCacheStore store;
private ICacheEntryHelper helper;
private SortedSet <MemoryCacheEntry> entries;
protected CacheEntryCollection (MemoryCacheStore store, ICacheEntryHelper helper)
{
this.store = store;
this.helper = helper;
entries = new SortedSet <MemoryCacheEntry> (helper);
}
protected void Add (MemoryCacheEntry entry)
{
entries.Add (entry);
}
protected void Remove (MemoryCacheEntry entry)
{
entries.Remove (entry);
}
protected int FlushItems (DateTime limit, CacheEntryRemovedReason reason, bool blockInsert, int count = int.MaxValue)
{
var flushedItems = 0;
if (blockInsert)
store.BlockInsert ();
foreach (var entry in entries) {
if (helper.GetDateTime (entry) > limit || flushedItems >= count)
break;
flushedItems++;
}
for (var f = 0; f < flushedItems; f++)
store.Remove (entries.Min, null, reason);
if (blockInsert)
store.UnblockInsert ();
return flushedItems;
}
}
}

View File

@@ -0,0 +1,81 @@
// This file implements the classes ExpiresEntryRef and CacheExpires missing from .NET reference source
using System.Threading;
namespace System.Runtime.Caching
{
class ExpiresEntryRef
{
public static ExpiresEntryRef INVALID = new ExpiresEntryRef ();
public bool IsInvalid {
get { return this == INVALID; }
}
}
class CacheExpiresHelper : ICacheEntryHelper
{
public int Compare(MemoryCacheEntry entry1, MemoryCacheEntry entry2)
{
return DateTime.Compare (entry1.UtcAbsExp , entry2.UtcAbsExp);
}
public DateTime GetDateTime (MemoryCacheEntry entry)
{
return entry.UtcAbsExp;
}
}
class CacheExpires : CacheEntryCollection
{
public static TimeSpan MIN_UPDATE_DELTA = new TimeSpan (0, 0, 1);
public static TimeSpan EXPIRATIONS_INTERVAL = new TimeSpan (0, 0, 20);
public static CacheExpiresHelper helper = new CacheExpiresHelper ();
Timer timer;
public CacheExpires (MemoryCacheStore store)
: base (store, helper)
{
}
public void Add (MemoryCacheEntry entry)
{
entry.ExpiresEntryRef = new ExpiresEntryRef ();
base.Add (entry);
}
public void Remove (MemoryCacheEntry entry)
{
base.Remove (entry);
entry.ExpiresEntryRef = ExpiresEntryRef.INVALID;
}
public void UtcUpdate (MemoryCacheEntry entry, DateTime utcAbsExp)
{
base.Remove (entry);
entry.UtcAbsExp = utcAbsExp;
base.Add (entry);
}
public void EnableExpirationTimer (bool enable)
{
if (enable) {
if (timer != null)
return;
var period = (int) EXPIRATIONS_INTERVAL.TotalMilliseconds;
timer = new Timer ((o) => FlushExpiredItems (true), null, period, period);
} else {
timer.Dispose ();
timer = null;
}
}
public int FlushExpiredItems (bool blockInsert)
{
return base.FlushItems (DateTime.UtcNow, CacheEntryRemovedReason.Expired, blockInsert);
}
}
}

View File

@@ -0,0 +1,82 @@
// This file implements the classes UsageEntryRef and CacheUsage missing from .NET reference source
namespace System.Runtime.Caching {
class UsageEntryRef {
public static UsageEntryRef INVALID = new UsageEntryRef ();
public bool IsInvalid {
get { return this == INVALID; }
}
// This is used to compare MemoryCacheEntry that have the same UtcLastUpdateUsage.
public int DateTimeIndex {
get; set;
}
}
class CacheUsageHelper : ICacheEntryHelper
{
public int Compare(MemoryCacheEntry entry1, MemoryCacheEntry entry2)
{
var ret = DateTime.Compare (entry1.UtcLastUpdateUsage , entry2.UtcLastUpdateUsage);
if (ret == 0)
return entry1.UsageEntryRef.DateTimeIndex - entry2.UsageEntryRef.DateTimeIndex;
return ret;
}
public DateTime GetDateTime (MemoryCacheEntry entry)
{
return entry.UtcLastUpdateUsage;
}
}
class CacheUsage : CacheEntryCollection {
public static TimeSpan CORRELATED_REQUEST_TIMEOUT = new TimeSpan (0, 0, 10);
public static TimeSpan MIN_LIFETIME_FOR_USAGE = new TimeSpan (0, 0, 10);
public static CacheUsageHelper helper = new CacheUsageHelper ();
public DateTime prevDateTime;
public int dateTimeIndex;
public CacheUsage (MemoryCacheStore store)
: base (store, helper)
{
}
public void Add (MemoryCacheEntry entry)
{
var now = DateTime.UtcNow;
if (now == prevDateTime)
dateTimeIndex++;
else
dateTimeIndex = 0;
prevDateTime = now;
entry.UtcLastUpdateUsage = now;
entry.UsageEntryRef = new UsageEntryRef ();
entry.UsageEntryRef.DateTimeIndex = dateTimeIndex;
base.Add (entry);
}
public void Remove (MemoryCacheEntry entry)
{
base.Remove (entry);
entry.UsageEntryRef = UsageEntryRef.INVALID;
}
public void Update (MemoryCacheEntry entry)
{
base.Remove (entry);
entry.UtcLastUpdateUsage = DateTime.UtcNow;
base.Add (entry);
}
public int FlushUnderUsedItems (int count)
{
return base.FlushItems (DateTime.MaxValue, CacheEntryRemovedReason.Evicted, true, count);
}
}
}

View File

@@ -0,0 +1,238 @@
// This is a copy of external/referencesource/System.Runtime.Caching/Resources/R.Designer.cs
// This verison does not use ResourceManager, instead it uses hard coded strings.
// This should be removed once Mono has access to .NET resources.
namespace System.Runtime.Caching.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class R {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Grandfathered suppression from original caching code checkin")]
internal R() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Runtime.Caching.Resources.R", typeof(R).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &apos;{0}&apos; must be greater than or equal to &apos;{1}&apos; and less than or equal to &apos;{2}&apos;..
/// </summary>
internal static string Argument_out_of_range {
get {
return "Argument_out_of_range";
}
}
/// <summary>
/// Looks up a localized string similar to The collection &apos;{0}&apos; contains a null element..
/// </summary>
internal static string Collection_contains_null_element {
get {
return "Collection_contains_null_element";
}
}
/// <summary>
/// Looks up a localized string similar to The collection &apos;{0}&apos; contains a null or empty string..
/// </summary>
internal static string Collection_contains_null_or_empty_string {
get {
return "Collection_contains_null_or_empty_string";
}
}
/// <summary>
/// Looks up a localized string similar to Unable to retrieve configuration section &apos;{0}&apos;..
/// </summary>
internal static string Config_unable_to_get_section {
get {
return "Config_unable_to_get_section";
}
}
/// <summary>
/// Looks up a localized string similar to Default is a reserved MemoryCache name..
/// </summary>
internal static string Default_is_reserved {
get {
return "Default_is_reserved";
}
}
/// <summary>
/// Looks up a localized string similar to The collection &apos;{0}&apos; is empty..
/// </summary>
internal static string Empty_collection {
get {
return "Empty_collection";
}
}
/// <summary>
/// Looks up a localized string similar to Initialization has not completed yet. The InitializationComplete method must be invoked before Dispose is invoked..
/// </summary>
internal static string Init_not_complete {
get {
return "Init_not_complete";
}
}
/// <summary>
/// Looks up a localized string similar to One of the following parameters must be specified: dependencies, absoluteExpiration, slidingExpiration..
/// </summary>
internal static string Invalid_argument_combination {
get {
return "Invalid_argument_combination";
}
}
/// <summary>
/// Looks up a localized string similar to Only one callback can be specified. Either RemovedCallback or UpdateCallback must be null..
/// </summary>
internal static string Invalid_callback_combination {
get {
return "Invalid_callback_combination";
}
}
/// <summary>
/// Looks up a localized string similar to AbsoluteExpiration must be DateTimeOffset.MaxValue or SlidingExpiration must be TimeSpan.Zero..
/// </summary>
internal static string Invalid_expiration_combination {
get {
return "Invalid_expiration_combination";
}
}
/// <summary>
/// Looks up a localized string similar to Invalid state..
/// </summary>
internal static string Invalid_state {
get {
return "Invalid_state";
}
}
/// <summary>
/// Looks up a localized string similar to The method has already been invoked, and can only be invoked once..
/// </summary>
internal static string Method_already_invoked {
get {
return "Method_already_invoked";
}
}
/// <summary>
/// Looks up a localized string similar to The property has already been set, and can only be set once..
/// </summary>
internal static string Property_already_set {
get {
return "Property_already_set";
}
}
/// <summary>
/// Looks up a localized string similar to Invalid configuration: {0}=&quot;{1}&quot;. The {0} value must be a time interval that can be parsed by System.TimeSpan.Parse..
/// </summary>
internal static string TimeSpan_invalid_format {
get {
return "TimeSpan_invalid_format";
}
}
/// <summary>
/// Looks up a localized string similar to CacheItemUpdateCallback must be null..
/// </summary>
internal static string Update_callback_must_be_null {
get {
return "Update_callback_must_be_null";
}
}
/// <summary>
/// Looks up a localized string similar to Invalid configuration: {0}=&quot;{1}&quot;. The {0} value must be a non-negative 32-bit integer..
/// </summary>
internal static string Value_must_be_non_negative_integer {
get {
return "Value_must_be_non_negative_integer";
}
}
/// <summary>
/// Looks up a localized string similar to Invalid configuration: {0}=&quot;{1}&quot;. The {0} value must be a positive 32-bit integer..
/// </summary>
internal static string Value_must_be_positive_integer {
get {
return "Value_must_be_positive_integer";
}
}
/// <summary>
/// Looks up a localized string similar to Invalid configuration: {0}=&quot;{1}&quot;. The {0} value cannot be greater than &apos;{2}&apos;..
/// </summary>
internal static string Value_too_big {
get {
return "Value_too_big";
}
}
/// <summary>
/// Looks up a localized string similar to An empty string is invalid..
/// </summary>
internal static string Empty_string_invalid {
get {
return "Empty_string_invalid";
}
}
/// <summary>
/// Looks up a localized string similar to The parameter regionName must be null..
/// </summary>
internal static string RegionName_not_supported {
get {
return "RegionName_not_supported";
}
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Caching {
/*
* This class is used to retrieve the size of an object graph.
* Although Mono has not a way of computing this.
* Known problems:
* - CacheMemoryMonitor does not trim the cache when it reaches its memory size limit.
* - IMemoryCacheManager.UpdateCacheSize is called with incorrect size.
*/
internal class SRef {
private Object _sizedRef;
internal SRef (Object target) {
_sizedRef = target;
}
internal long ApproximateSize {
get { return (long) Marshal.SizeOf (_sizedRef.GetType ()); }
}
internal void Dispose() {
}
}
}

View File

@@ -1,44 +0,0 @@
//
// CachingSectionGroup.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Configuration;
namespace System.Runtime.Caching.Configuration
{
public sealed class CachingSectionGroup : ConfigurationSectionGroup
{
[ConfigurationProperty ("memoryCache")]
public MemoryCacheSection MemoryCaches {
get { return Sections ["memoryCache"] as MemoryCacheSection; }
}
public CachingSectionGroup ()
{
}
}
}

View File

@@ -1,5 +0,0 @@
2010-04-24 Marek Habersack <mhabersack@novell.com>
* MemoryCacheSettingsCollection.cs: added and implemented methods
which appeared in .NET 4.0 final.

View File

@@ -1,110 +0,0 @@
//
// MemoryCacheElement.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.ComponentModel;
using System.Configuration;
namespace System.Runtime.Caching.Configuration
{
public sealed class MemoryCacheElement : ConfigurationElement
{
static ConfigurationProperty cacheMemoryLimitMegabytesProp;
static ConfigurationProperty nameProp;
static ConfigurationProperty physicalMemoryLimitPercentageProp;
static ConfigurationProperty pollingIntervalProp;
static ConfigurationPropertyCollection properties;
[ConfigurationProperty ("cacheMemoryLimitMegabytes", DefaultValue = 0)]
[IntegerValidator (MinValue = 1)]
public int CacheMemoryLimitMegabytes {
get { return (int) base [cacheMemoryLimitMegabytesProp]; }
set { base [cacheMemoryLimitMegabytesProp] = value; }
}
[ConfigurationProperty ("name", DefaultValue = "", IsRequired = true, IsKey = true)]
[TypeConverter (typeof(WhiteSpaceTrimStringConverter))]
[StringValidator (MinLength = 1)]
public string Name {
get { return (string) base [nameProp]; }
set { base [nameProp] = value; }
}
[ConfigurationProperty ("physicalMemoryLimitPercentage", DefaultValue = 0)]
[IntegerValidator (MinValue = 1, MaxValue = 100)]
public int PhysicalMemoryLimitPercentage {
get { return (int) base [physicalMemoryLimitPercentageProp]; }
set { base [physicalMemoryLimitPercentageProp] = value; }
}
[ConfigurationProperty ("pollingInterval", DefaultValue = "00:02:00")]
[TypeConverter (typeof(InfiniteTimeSpanConverter))]
public TimeSpan PollingInterval {
get { return (TimeSpan) base [pollingIntervalProp]; }
set { base [pollingIntervalProp] = value; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
static MemoryCacheElement ()
{
cacheMemoryLimitMegabytesProp = new ConfigurationProperty ("cacheMemoryLimitMegabytes", typeof (int), 0,
TypeDescriptor.GetConverter (typeof (int)),
new IntegerValidator (1, Int32.MaxValue),
ConfigurationPropertyOptions.None);
nameProp = new ConfigurationProperty ("name", typeof (string), String.Empty,
TypeDescriptor.GetConverter (typeof (string)),
new NullableStringValidator (1),
ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
physicalMemoryLimitPercentageProp = new ConfigurationProperty ("physicalMemoryLimitPercentage", typeof (int), 0,
TypeDescriptor.GetConverter (typeof (int)),
new IntegerValidator (1, 100),
ConfigurationPropertyOptions.None);
pollingIntervalProp = new ConfigurationProperty ("pollingInterval", typeof (TimeSpan), TimeSpan.FromMinutes (2),
new InfiniteTimeSpanConverter (),
new DefaultValidator (),
ConfigurationPropertyOptions.None);
properties = new ConfigurationPropertyCollection ();
properties.Add (cacheMemoryLimitMegabytesProp);
properties.Add (nameProp);
properties.Add (physicalMemoryLimitPercentageProp);
properties.Add (pollingIntervalProp);
}
internal MemoryCacheElement ()
{
}
public MemoryCacheElement (string name)
{
this.Name = name;
}
}
}

View File

@@ -1,59 +0,0 @@
//
// MemoryCacheSection.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Configuration;
namespace System.Runtime.Caching.Configuration
{
public sealed class MemoryCacheSection : ConfigurationSection
{
static ConfigurationProperty namedCachesProp;
static ConfigurationPropertyCollection properties;
static MemoryCacheSection ()
{
namedCachesProp = new ConfigurationProperty ("namedCaches", typeof (MemoryCacheSettingsCollection), null);
properties = new ConfigurationPropertyCollection ();
properties.Add (namedCachesProp);
}
public MemoryCacheSection ()
{
}
[ConfigurationProperty ("namedCaches")]
public MemoryCacheSettingsCollection NamedCaches {
get { return base [namedCachesProp] as MemoryCacheSettingsCollection; }
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
}
}

View File

@@ -1,124 +0,0 @@
//
// MemoryCacheSettingsCollection.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Configuration;
namespace System.Runtime.Caching.Configuration
{
[ConfigurationCollection (typeof(MemoryCacheElement), CollectionType = ConfigurationElementCollectionType.AddRemoveClearMap)]
public sealed class MemoryCacheSettingsCollection : ConfigurationElementCollection
{
static ConfigurationPropertyCollection properties;
public override ConfigurationElementCollectionType CollectionType {
get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
}
public MemoryCacheElement this[int index] {
get { return BaseGet (index) as MemoryCacheElement; }
set {
if (BaseGet (index) != null)
BaseRemoveAt (index);
BaseAdd (index, value);
}
}
public new MemoryCacheElement this[string key] {
get {
foreach (MemoryCacheElement mce in this) {
if (String.Compare (key, mce.Name, StringComparison.Ordinal) == 0)
return mce;
}
return null;
}
}
protected override ConfigurationPropertyCollection Properties {
get { return properties; }
}
static MemoryCacheSettingsCollection ()
{
properties = new ConfigurationPropertyCollection ();
}
public MemoryCacheSettingsCollection ()
{
}
public void Add (MemoryCacheElement cache)
{
BaseAdd (cache);
}
public void Clear ()
{
BaseClear ();
}
protected override ConfigurationElement CreateNewElement ()
{
return new MemoryCacheElement ();
}
protected override ConfigurationElement CreateNewElement (string elementName)
{
return new MemoryCacheElement (elementName);
}
protected override object GetElementKey (ConfigurationElement element)
{
if (element == null)
return null;
return ((MemoryCacheElement)element).Name;
}
public int IndexOf (MemoryCacheElement cache)
{
if (cache == null)
return -1;
return BaseIndexOf (cache);
}
public void Remove (MemoryCacheElement cache)
{
if (cache == null)
return;
BaseRemove (GetElementKey (cache));
}
public void RemoveAt (int index)
{
BaseRemoveAt (index);
}
}
}

View File

@@ -1,36 +0,0 @@
//
// IApplicationIdentifier.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Caching.Hosting
{
public interface IApplicationIdentifier
{
string GetApplicationId ();
}
}

View File

@@ -1,37 +0,0 @@
//
// IFileChangeNotificationSystem.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Caching.Hosting
{
public interface IFileChangeNotificationSystem
{
void StartMonitoring (string filePath, OnChangedCallback onChangedCallback, out object state, out DateTimeOffset lastWriteTime, out long fileSize);
void StopMonitoring (string filePath, object state);
}
}

View File

@@ -1,38 +0,0 @@
//
// IMemoryCacheManager.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Runtime.Caching;
namespace System.Runtime.Caching.Hosting
{
public interface IMemoryCacheManager
{
void ReleaseCache (MemoryCache cache);
void UpdateCacheSize (long size, MemoryCache cache);
}
}

View File

@@ -4,38 +4,50 @@
../System.Web/System.Web.Configuration_2.0/NullableStringValidator.cs
Assembly/AssemblyInfo.cs
System.Runtime.Caching/CacheEntryChangeMonitor.cs
System.Runtime.Caching/CacheEntryRemovedArguments.cs
System.Runtime.Caching/CacheEntryRemovedCallback.cs
System.Runtime.Caching/CacheEntryRemovedReason.cs
System.Runtime.Caching/CacheEntryUpdateArguments.cs
System.Runtime.Caching/CacheEntryUpdateCallback.cs
System.Runtime.Caching/CacheItem.cs
System.Runtime.Caching/CacheItemPolicy.cs
System.Runtime.Caching/CacheItemPriority.cs
System.Runtime.Caching/ChangeMonitor.cs
System.Runtime.Caching/DefaultCacheCapabilities.cs
System.Runtime.Caching/FileChangeMonitor.cs
System.Runtime.Caching/FileChangeNotificationSystem.cs
System.Runtime.Caching/FileChangeNotificationSystemEntry.cs
System.Runtime.Caching/Helpers.cs
System.Runtime.Caching/HostFileChangeMonitor.cs
System.Runtime.Caching/MemoryCache.cs
System.Runtime.Caching/MemoryCacheContainer.cs
System.Runtime.Caching/MemoryCacheEntry.cs
System.Runtime.Caching/MemoryCacheEntryChangeMonitor.cs
System.Runtime.Caching/MemoryCacheLRU.cs
System.Runtime.Caching/MemoryCachePerformanceCounters.cs
System.Runtime.Caching/MemoryCacheEntryPriorityQueue.cs
System.Runtime.Caching/ObjectCache.cs
System.Runtime.Caching/OnChangedCallback.cs
System.Runtime.Caching/SqlChangeMonitor.cs
System.Runtime.Caching.Configuration/CachingSectionGroup.cs
System.Runtime.Caching.Configuration/MemoryCacheSection.cs
System.Runtime.Caching.Configuration/MemoryCacheSettingsCollection.cs
System.Runtime.Caching.Configuration/MemoryCacheElement.cs
System.Runtime.Caching.Hosting/IApplicationIdentifier.cs
System.Runtime.Caching.Hosting/IFileChangeNotificationSystem.cs
System.Runtime.Caching.Hosting/IMemoryCacheManager.cs
ReferenceSources/CacheEntryCollection.cs
ReferenceSources/CacheExpires.cs
ReferenceSources/CacheUsage.cs
ReferenceSources/R.Designer.cs
ReferenceSources/SRef.cs
../../../external/referencesource/System.Runtime.Caching/Resources/RH.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheEntryChangeMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheEntryRemovedArguments.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheEntryRemovedCallback.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheEntryRemovedReason.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheEntryUpdateArguments.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheEntryUpdateCallback.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheItem.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheItemPolicy.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheItemPriority.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/CacheMemoryMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/ChangeMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Configuration/CachingSectionGroup.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Configuration/ConfigUtil.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Configuration/MemoryCacheElement.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Configuration/MemoryCacheSection.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Configuration/MemoryCacheSettingsCollection.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Dbg.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/DefaultCacheCapabilities.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/EntryState.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/FileChangeMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/FileChangeNotificationSystem.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/HostFileChangeMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Hosting/IApplicationIdentifier.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Hosting/IFileChangeNotificationSystem.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/Hosting/IMemoryCacheManager.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCache.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheEntry.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheEntryChangeMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheKey.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheKeyEqualityComparer.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStatistics.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryCacheStore.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/MemoryMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/ObjectCache.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/OnChangedCallback.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/PerfCounterName.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/PerfCounters.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/PhysicalMemoryMonitor.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/SafeBitVector32.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/SafeRegistryHandle.cs
../../../external/referencesource/System.Runtime.Caching/System/Caching/SqlChangeMonitor.cs

View File

@@ -1,43 +0,0 @@
//
// CacheEntryChangeMonitor.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
namespace System.Runtime.Caching
{
public abstract class CacheEntryChangeMonitor : ChangeMonitor
{
public abstract ReadOnlyCollection<string> CacheKeys { get; }
public abstract DateTimeOffset LastModified { get; }
public abstract string RegionName { get; }
protected CacheEntryChangeMonitor ()
{
}
}
}

View File

@@ -1,51 +0,0 @@
//
// CacheEntryRemovedArguments.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Caching
{
public class CacheEntryRemovedArguments
{
public CacheItem CacheItem { get; private set; }
public CacheEntryRemovedReason RemovedReason { get; private set; }
public ObjectCache Source { get; private set; }
public CacheEntryRemovedArguments (ObjectCache source, CacheEntryRemovedReason reason, CacheItem cacheItem)
{
if (source == null)
throw new ArgumentNullException ("source");
if (cacheItem == null)
throw new ArgumentNullException ("cacheItem");
this.CacheItem = cacheItem;
this.RemovedReason = reason;
this.Source = source;
}
}
}

View File

@@ -1,33 +0,0 @@
//
// CacheEntryRemovedCallback.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Caching
{
public delegate void CacheEntryRemovedCallback (CacheEntryRemovedArguments arguments);
}

View File

@@ -1,40 +0,0 @@
//
// CacheEntryRemoveReason.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Caching
{
public enum CacheEntryRemovedReason
{
Removed,
Expired,
Evicted,
ChangeMonitorChanged,
CacheSpecificEviction
}
}

View File

@@ -1,55 +0,0 @@
//
// CacheEntryUpdateArguments.cs
//
// Authors:
// Marek Habersack <mhabersack@novell.com>
//
// Copyright (C) 2010 Novell, Inc. (http://novell.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Runtime.Caching
{
public class CacheEntryUpdateArguments
{
public string Key { get; private set; }
public string RegionName { get; private set; }
public CacheEntryRemovedReason RemovedReason { get; private set; }
public ObjectCache Source { get; private set; }
public CacheItem UpdatedCacheItem { get; set; }
public CacheItemPolicy UpdatedCacheItemPolicy { get; set; }
public CacheEntryUpdateArguments (ObjectCache source, CacheEntryRemovedReason reason, string key, string regionName)
{
if (source == null)
throw new ArgumentNullException ("source");
if (key == null)
throw new ArgumentNullException ("key");
this.Key = key;
this.RegionName = regionName;
this.RemovedReason = reason;
this.Source = source;
}
}
}

Some files were not shown because too many files have changed in this diff Show More