Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Util / SimpleRecyclingCache.cs / 3 / 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; } } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- View.cs
- UIElement.cs
- OuterGlowBitmapEffect.cs
- IntSecurity.cs
- ContentPosition.cs
- XmlDeclaration.cs
- AppDomainInfo.cs
- NeutralResourcesLanguageAttribute.cs
- COM2PictureConverter.cs
- KeyValuePairs.cs
- ToolStripContainerDesigner.cs
- VerificationException.cs
- WindowProviderWrapper.cs
- EmptyStringExpandableObjectConverter.cs
- NamedPipeActivation.cs
- SwitchLevelAttribute.cs
- QuadTree.cs
- VisualStyleInformation.cs
- RectangleF.cs
- WindowsComboBox.cs
- LifetimeServices.cs
- HttpListener.cs
- Unit.cs
- SocketInformation.cs
- Block.cs
- VersionConverter.cs
- SafeArchiveContext.cs
- EntitySetDataBindingList.cs
- ThemeableAttribute.cs
- COM2FontConverter.cs
- ComponentTray.cs
- EventProviderWriter.cs
- JsonQueryStringConverter.cs
- MaskedTextProvider.cs
- Types.cs
- PingReply.cs
- IncrementalReadDecoders.cs
- ClonableStack.cs
- Rect3D.cs
- ErrorEventArgs.cs
- MetadataSerializer.cs
- OdbcFactory.cs
- AstNode.cs
- compensatingcollection.cs
- DataServiceException.cs
- RawTextInputReport.cs
- Int32EqualityComparer.cs
- StrongTypingException.cs
- ToolStripSeparator.cs
- RijndaelManaged.cs
- GlobalizationSection.cs
- WhitespaceRuleLookup.cs
- TypeBuilder.cs
- PackageFilter.cs
- TimeStampChecker.cs
- WpfSharedXamlSchemaContext.cs
- ListViewAutomationPeer.cs
- DesignerInterfaces.cs
- PixelFormat.cs
- TransportConfigurationTypeElement.cs
- DataRelation.cs
- PropertyGridView.cs
- CodeValidator.cs
- LocationSectionRecord.cs
- ObjectParameterCollection.cs
- SafeEventLogWriteHandle.cs
- PermissionSet.cs
- HelpKeywordAttribute.cs
- PngBitmapEncoder.cs
- XmlEnumAttribute.cs
- RSAPKCS1SignatureFormatter.cs
- DataGridViewCellStyle.cs
- Style.cs
- StringCollection.cs
- CodeCatchClauseCollection.cs
- NativeMethods.cs
- SqlFacetAttribute.cs
- ConfigurationException.cs
- ScriptManager.cs
- OdbcEnvironmentHandle.cs
- ClrProviderManifest.cs
- RoleService.cs
- RadioButtonList.cs
- BoundingRectTracker.cs
- LineGeometry.cs
- CacheEntry.cs
- Rss20FeedFormatter.cs
- OdbcConnectionFactory.cs
- Listbox.cs
- BitmapMetadata.cs
- HwndPanningFeedback.cs
- NullableIntAverageAggregationOperator.cs
- ToolStripSeparatorRenderEventArgs.cs
- WindowsTitleBar.cs
- IERequestCache.cs
- ProxyHwnd.cs
- LinqDataView.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- DataGridLinkButton.cs
- StrokeCollection2.cs