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
- TreeNodeStyleCollection.cs
- TextDecorationCollection.cs
- Thumb.cs
- CodeTypeMemberCollection.cs
- TextServicesCompartmentEventSink.cs
- DesignerResources.cs
- QueryPageSettingsEventArgs.cs
- ResolveMatchesMessage11.cs
- EntitySetRetriever.cs
- DebugViewWriter.cs
- Matrix3DValueSerializer.cs
- DbProviderFactoriesConfigurationHandler.cs
- DeclaredTypeValidator.cs
- PeerNameRegistration.cs
- IncrementalReadDecoders.cs
- SafeHandles.cs
- remotingproxy.cs
- CompilationUtil.cs
- MetadataProperty.cs
- Type.cs
- LogSwitch.cs
- DesignerView.xaml.cs
- CompositeCollection.cs
- SqlMultiplexer.cs
- FrameworkEventSource.cs
- SqlInternalConnectionSmi.cs
- ConnectionsZoneDesigner.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ASCIIEncoding.cs
- BitVector32.cs
- TreeView.cs
- TreeIterator.cs
- Query.cs
- CacheForPrimitiveTypes.cs
- SmiConnection.cs
- TokenFactoryBase.cs
- WebPartsSection.cs
- SecurityPermission.cs
- CallbackException.cs
- XmlSerializationWriter.cs
- StorageAssociationTypeMapping.cs
- WorkflowElementDialog.cs
- ComplexPropertyEntry.cs
- FormParameter.cs
- HttpCachePolicyBase.cs
- BidPrivateBase.cs
- NetTcpBinding.cs
- DiagnosticTrace.cs
- SimpleWebHandlerParser.cs
- MenuItem.cs
- XmlNamedNodeMap.cs
- Sql8ExpressionRewriter.cs
- ExpressionEditorAttribute.cs
- DiscoveryDocument.cs
- SessionStateContainer.cs
- HierarchicalDataBoundControl.cs
- OutputCacheSettings.cs
- DependentTransaction.cs
- CaseInsensitiveOrdinalStringComparer.cs
- SafeThreadHandle.cs
- BoolLiteral.cs
- BrowserCapabilitiesCompiler.cs
- RoutedEvent.cs
- WindowHideOrCloseTracker.cs
- Internal.cs
- CryptoProvider.cs
- ContentElementAutomationPeer.cs
- TreeViewImageIndexConverter.cs
- precedingsibling.cs
- COM2ExtendedUITypeEditor.cs
- SqlDataRecord.cs
- MailBnfHelper.cs
- PaperSize.cs
- SqlGatherProducedAliases.cs
- ToolStripEditorManager.cs
- TextRangeProviderWrapper.cs
- ColorKeyFrameCollection.cs
- EntityPropertyMappingAttribute.cs
- ParseChildrenAsPropertiesAttribute.cs
- ObjectDataSourceWizardForm.cs
- BCLDebug.cs
- Figure.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- DataShape.cs
- XmlCompatibilityReader.cs
- XmlNamespaceManager.cs
- ToolStripStatusLabel.cs
- WrapPanel.cs
- SqlHelper.cs
- odbcmetadatacolumnnames.cs
- ExceptionAggregator.cs
- SubstitutionResponseElement.cs
- OperationParameterInfo.cs
- ButtonBase.cs
- FormatConvertedBitmap.cs
- PagerStyle.cs
- DocumentSequenceHighlightLayer.cs
- InkCanvasSelectionAdorner.cs
- SynchronizationFilter.cs
- ThemeInfoAttribute.cs