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
- BitmapPalette.cs
- WebServiceMethodData.cs
- PathFigure.cs
- BindingMAnagerBase.cs
- ConfigurationSectionGroup.cs
- SimpleWorkerRequest.cs
- DemultiplexingDispatchMessageFormatter.cs
- AppModelKnownContentFactory.cs
- AbandonedMutexException.cs
- TraceProvider.cs
- UpdateTranslator.cs
- ISSmlParser.cs
- SqlNode.cs
- AutomationAttributeInfo.cs
- ObjectTag.cs
- RepeatInfo.cs
- CursorConverter.cs
- SettingsPropertyValue.cs
- RoutedEventArgs.cs
- IdnMapping.cs
- BoundingRectTracker.cs
- WpfPayload.cs
- SchemaSetCompiler.cs
- CodeCompiler.cs
- MergeExecutor.cs
- ToolTipService.cs
- RadioButtonAutomationPeer.cs
- XmlTypeAttribute.cs
- PagePropertiesChangingEventArgs.cs
- COM2PropertyPageUITypeConverter.cs
- WeakEventTable.cs
- ListBindableAttribute.cs
- HtmlTextArea.cs
- PersonalizationState.cs
- EventDescriptorCollection.cs
- StylusPointPropertyInfoDefaults.cs
- ActivityDesignerAccessibleObject.cs
- PolyBezierSegmentFigureLogic.cs
- UnionCodeGroup.cs
- FrameworkContentElementAutomationPeer.cs
- FacetEnabledSchemaElement.cs
- CodeIterationStatement.cs
- SigningCredentials.cs
- MobileTextWriter.cs
- SHA512Managed.cs
- ObjectQueryState.cs
- PropertyChange.cs
- DataServiceRequestOfT.cs
- ScalarType.cs
- SqlEnums.cs
- TableLayout.cs
- XmlMapping.cs
- QueryResponse.cs
- Pkcs7Signer.cs
- ObjectStateManager.cs
- XmlNodeChangedEventArgs.cs
- PrintingPermission.cs
- Int16Storage.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- ValueTypeIndexerReference.cs
- TextBox.cs
- SqlCommandBuilder.cs
- Clock.cs
- Triangle.cs
- Label.cs
- OverflowException.cs
- UpDownEvent.cs
- TiffBitmapEncoder.cs
- CertificateManager.cs
- SizeValueSerializer.cs
- Constants.cs
- AxisAngleRotation3D.cs
- MsmqIntegrationChannelFactory.cs
- ErrorTableItemStyle.cs
- UnmanagedMemoryStreamWrapper.cs
- GradientSpreadMethodValidation.cs
- DmlSqlGenerator.cs
- ControlValuePropertyAttribute.cs
- TableRowGroup.cs
- TypeInitializationException.cs
- ErrorStyle.cs
- Screen.cs
- xdrvalidator.cs
- WebControl.cs
- TableCell.cs
- CapabilitiesAssignment.cs
- Latin1Encoding.cs
- CatalogPart.cs
- FullTextLine.cs
- SiteOfOriginContainer.cs
- HybridObjectCache.cs
- DateTimeValueSerializerContext.cs
- HotCommands.cs
- XmlAggregates.cs
- TargetInvocationException.cs
- LogSwitch.cs
- References.cs
- XmlSchemaObjectTable.cs
- ContentValidator.cs
- MgmtConfigurationRecord.cs