Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Util / SimpleRecyclingCache.cs / 4 / SimpleRecyclingCache.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * SimpleRecyclingCache class * * Copyright (c) 1999 Microsoft Corporation */ namespace System.Web.Util { using System.Collections; /* * The purpose of this class is to provide a simple and efficient cache. * Instead of using fancy logic to expire items, it uses a simple heuristic: * when the number of entry reaches a fixed limit, the cache is reset. */ internal class SimpleRecyclingCache { private const int MAX_SIZE = 100; private static Hashtable _hashtable; internal SimpleRecyclingCache() { CreateHashtable(); } // Create or recreate the hastable private void CreateHashtable() { _hashtable = new Hashtable(MAX_SIZE, StringComparer.OrdinalIgnoreCase); } internal object this[object key] { get { return _hashtable[key]; } set { lock (this) { // The limit was reached, so reset everything if (_hashtable.Count >= MAX_SIZE) _hashtable.Clear(); _hashtable[key] = value; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProxyGenerationError.cs
- GenericUriParser.cs
- ResourceDictionaryCollection.cs
- Win32KeyboardDevice.cs
- AssertFilter.cs
- XmlSchemaAll.cs
- AnnotationComponentManager.cs
- ArraySegment.cs
- Attachment.cs
- DataGrid.cs
- StylusPointPropertyInfoDefaults.cs
- ControlEvent.cs
- XmlConvert.cs
- HtmlGenericControl.cs
- GenericsInstances.cs
- ResXDataNode.cs
- mediaclock.cs
- PerformanceCounterCategory.cs
- WebPartVerb.cs
- XmlIlVisitor.cs
- XmlNodeChangedEventArgs.cs
- ConstrainedDataObject.cs
- BaseAddressElement.cs
- HttpServerUtilityWrapper.cs
- RouteData.cs
- TcpDuplicateContext.cs
- XsdDuration.cs
- URL.cs
- ProcessHostServerConfig.cs
- KernelTypeValidation.cs
- WindowCollection.cs
- SQLStringStorage.cs
- DebuggerAttributes.cs
- FocusWithinProperty.cs
- WebPartUtil.cs
- XmlQuerySequence.cs
- FrameworkRichTextComposition.cs
- OleDbException.cs
- HotSpotCollection.cs
- documentation.cs
- WorkflowRequestContext.cs
- StronglyTypedResourceBuilder.cs
- DynamicPhysicalDiscoSearcher.cs
- ParseElement.cs
- XmlReaderSettings.cs
- HwndStylusInputProvider.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- PackageRelationshipSelector.cs
- ImageList.cs
- ScriptDescriptor.cs
- PageContentCollection.cs
- XComponentModel.cs
- MsmqReceiveParameters.cs
- ClientSponsor.cs
- LocatorBase.cs
- TemplateBuilder.cs
- UnhandledExceptionEventArgs.cs
- CompilationSection.cs
- GrammarBuilderRuleRef.cs
- Base64Encoding.cs
- DataGridViewRowsAddedEventArgs.cs
- PasswordDeriveBytes.cs
- PowerStatus.cs
- PathBox.cs
- TextProperties.cs
- OdbcUtils.cs
- ThicknessConverter.cs
- SqlColumnizer.cs
- DbTransaction.cs
- TextCharacters.cs
- While.cs
- TimeSpanOrInfiniteValidator.cs
- ParameterToken.cs
- ConfigXmlSignificantWhitespace.cs
- InvalidAsynchronousStateException.cs
- HotSpot.cs
- DataRowCollection.cs
- ClientSettingsProvider.cs
- CharAnimationBase.cs
- COM2FontConverter.cs
- CompositeActivityValidator.cs
- ZoneIdentityPermission.cs
- ExtensibleClassFactory.cs
- NoClickablePointException.cs
- ScrollChangedEventArgs.cs
- FixedTextPointer.cs
- CodeFieldReferenceExpression.cs
- TimelineClockCollection.cs
- ReachDocumentSequenceSerializer.cs
- DynamicILGenerator.cs
- SqlFormatter.cs
- ExtensionSimplifierMarkupObject.cs
- ServiceOperationDetailViewControl.cs
- OrCondition.cs
- Dictionary.cs
- SineEase.cs
- LongPath.cs
- GridViewRowCollection.cs
- IndentedWriter.cs
- ZipIOExtraFieldElement.cs