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
- DetailsViewModeEventArgs.cs
- BinaryFormatterSinks.cs
- TdsParserStateObject.cs
- ADConnectionHelper.cs
- DependencyPropertyKind.cs
- TreeViewBindingsEditor.cs
- CustomValidator.cs
- MediaEntryAttribute.cs
- SmtpMail.cs
- AsyncOperationManager.cs
- TextBoxView.cs
- TiffBitmapDecoder.cs
- ElementNotAvailableException.cs
- CalendarItem.cs
- FrameworkElementFactoryMarkupObject.cs
- ContainerActivationHelper.cs
- DataGridColumnReorderingEventArgs.cs
- HealthMonitoringSection.cs
- TransformerInfoCollection.cs
- SafeNativeMethods.cs
- Timeline.cs
- Blend.cs
- TextWriter.cs
- ListViewSortEventArgs.cs
- C14NUtil.cs
- CheckBoxFlatAdapter.cs
- HostingPreferredMapPath.cs
- CodeVariableReferenceExpression.cs
- IdentityManager.cs
- GenerateHelper.cs
- Viewport2DVisual3D.cs
- FieldDescriptor.cs
- HtmlPageAdapter.cs
- ChangeNode.cs
- XPathParser.cs
- LoginCancelEventArgs.cs
- HttpGetProtocolReflector.cs
- ObjectDataSource.cs
- WebPartCatalogCloseVerb.cs
- DataGridPageChangedEventArgs.cs
- SolidColorBrush.cs
- _DisconnectOverlappedAsyncResult.cs
- DbParameterCollection.cs
- PreDigestedSignedInfo.cs
- TransformerConfigurationWizardBase.cs
- BinarySerializer.cs
- ProcessHostMapPath.cs
- CheckBox.cs
- SymmetricCryptoHandle.cs
- AssemblyCacheEntry.cs
- MediaElementAutomationPeer.cs
- IItemProperties.cs
- NavigatorOutput.cs
- SessionEndingEventArgs.cs
- AdPostCacheSubstitution.cs
- FusionWrap.cs
- BlockCollection.cs
- PrincipalPermission.cs
- SqlDataSourceQueryConverter.cs
- HtmlTableCell.cs
- Internal.cs
- QuotedStringFormatReader.cs
- SubMenuStyle.cs
- EdmItemError.cs
- X509CertificateStore.cs
- RegistryKey.cs
- RubberbandSelector.cs
- CustomWebEventKey.cs
- Thickness.cs
- StylusOverProperty.cs
- Publisher.cs
- XmlArrayItemAttributes.cs
- TraceHandler.cs
- CreateUserWizard.cs
- ActivitySurrogate.cs
- GACIdentityPermission.cs
- SmtpSection.cs
- CharacterHit.cs
- ApplicationServiceManager.cs
- Nullable.cs
- QilFunction.cs
- RegularExpressionValidator.cs
- TextEmbeddedObject.cs
- ThemeDirectoryCompiler.cs
- DescriptionAttribute.cs
- WebPartConnectVerb.cs
- Vector3DValueSerializer.cs
- XamlUtilities.cs
- MaterialGroup.cs
- DaylightTime.cs
- ByteRangeDownloader.cs
- XmlSchemaComplexContent.cs
- RouteCollection.cs
- StringSorter.cs
- BridgeDataReader.cs
- JoinSymbol.cs
- DefaultParameterValueAttribute.cs
- FamilyCollection.cs
- SizeChangedInfo.cs
- EnumerableCollectionView.cs