Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / SimpleRecyclingCache.cs / 1305376 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DbProviderServices.cs
- ValidationErrorCollection.cs
- ColumnTypeConverter.cs
- CompoundFileStorageReference.cs
- SiteMapNodeItemEventArgs.cs
- QuotedPrintableStream.cs
- DrawingContextWalker.cs
- IconConverter.cs
- XmlMapping.cs
- SmtpFailedRecipientException.cs
- BindingList.cs
- Unit.cs
- IdentityReference.cs
- InternalTypeHelper.cs
- Directory.cs
- SqlLiftWhereClauses.cs
- _TimerThread.cs
- GridViewDeletedEventArgs.cs
- VisualBrush.cs
- StorageComplexPropertyMapping.cs
- SqlDataSourceCommandEventArgs.cs
- PageHandlerFactory.cs
- ProjectionCamera.cs
- XamlParser.cs
- PtsCache.cs
- EngineSiteSapi.cs
- AspCompat.cs
- SplashScreen.cs
- ToolConsole.cs
- TreeView.cs
- TextTreeInsertElementUndoUnit.cs
- ResourceExpressionEditor.cs
- SoapBinding.cs
- ImportCatalogPart.cs
- Constant.cs
- DLinqAssociationProvider.cs
- Column.cs
- SmiGettersStream.cs
- WS2007HttpBindingElement.cs
- SoundPlayer.cs
- ScriptModule.cs
- XmlBindingWorker.cs
- AccessControlEntry.cs
- MetadataCache.cs
- XmlSchemaParticle.cs
- TextElementEnumerator.cs
- CfgSemanticTag.cs
- UniqueEventHelper.cs
- Formatter.cs
- XmlUtilWriter.cs
- ImageSource.cs
- ContextMenuStripGroupCollection.cs
- ObjectQueryState.cs
- PropertyRef.cs
- BindingOperations.cs
- SpanIndex.cs
- WebHttpSecurityModeHelper.cs
- ScrollEvent.cs
- XmlParserContext.cs
- ScriptingJsonSerializationSection.cs
- ReadOnlyDataSource.cs
- ByteStorage.cs
- AssemblyFilter.cs
- FigureParagraph.cs
- Calendar.cs
- BorderGapMaskConverter.cs
- Debug.cs
- RichTextBox.cs
- BulletDecorator.cs
- FtpWebResponse.cs
- RectValueSerializer.cs
- SoapCommonClasses.cs
- ForwardPositionQuery.cs
- WindowManager.cs
- QuaternionRotation3D.cs
- DefaultHttpHandler.cs
- EncoderFallback.cs
- RegisterResponseInfo.cs
- InheritedPropertyChangedEventArgs.cs
- DefaultBinder.cs
- HttpStreamMessage.cs
- IDispatchConstantAttribute.cs
- InputLangChangeRequestEvent.cs
- WebEventTraceProvider.cs
- StateItem.cs
- XmlQueryOutput.cs
- SystemWebSectionGroup.cs
- TableStyle.cs
- datacache.cs
- Panel.cs
- KeyMatchBuilder.cs
- OledbConnectionStringbuilder.cs
- AmbientProperties.cs
- TextureBrush.cs
- MulticastOption.cs
- AspNetSynchronizationContext.cs
- UriTemplateClientFormatter.cs
- DictationGrammar.cs
- DependencyPropertyAttribute.cs
- ApplicationSecurityInfo.cs