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
- CurrentTimeZone.cs
- TripleDES.cs
- Range.cs
- isolationinterop.cs
- GenerateTemporaryTargetAssembly.cs
- XPathCompileException.cs
- X509CertificateCollection.cs
- KeyValueConfigurationElement.cs
- DPAPIProtectedConfigurationProvider.cs
- X509ScopedServiceCertificateElement.cs
- FullTextState.cs
- ControlIdConverter.cs
- HttpUnhandledOperationInvoker.cs
- IOThreadTimer.cs
- FontFamilyValueSerializer.cs
- DynamicDataExtensions.cs
- AnonymousIdentificationSection.cs
- InfiniteTimeSpanConverter.cs
- itemelement.cs
- Attributes.cs
- HandleCollector.cs
- Lasso.cs
- Convert.cs
- TemplateControlCodeDomTreeGenerator.cs
- TextServicesPropertyRanges.cs
- UriWriter.cs
- FigureParagraph.cs
- BindingExpressionUncommonField.cs
- FrameworkElement.cs
- WebBrowserHelper.cs
- LiteralText.cs
- CharacterMetrics.cs
- SecurityElement.cs
- PropertyNames.cs
- DataColumnMappingCollection.cs
- TypeBrowserDialog.cs
- PropertyGridDesigner.cs
- PropertyPathConverter.cs
- XmlText.cs
- SelectionProviderWrapper.cs
- httpserverutility.cs
- MessageBodyMemberAttribute.cs
- ProxyGenerator.cs
- ElementFactory.cs
- ValueTable.cs
- InputScopeAttribute.cs
- MimeTextImporter.cs
- BitmapEffectGroup.cs
- PanelStyle.cs
- TextBox.cs
- TcpServerChannel.cs
- TdsParserSessionPool.cs
- CacheAxisQuery.cs
- QilInvokeEarlyBound.cs
- IncrementalHitTester.cs
- ColumnResizeUndoUnit.cs
- ConfigXmlCDataSection.cs
- IODescriptionAttribute.cs
- HtmlUtf8RawTextWriter.cs
- Normalization.cs
- PrivilegeNotHeldException.cs
- WindowManager.cs
- CodeStatement.cs
- FormViewDeletedEventArgs.cs
- Vector3DCollectionConverter.cs
- AuthenticatedStream.cs
- LogicalExpressionTypeConverter.cs
- Point.cs
- DbException.cs
- ValueType.cs
- InputLanguageEventArgs.cs
- ParameterToken.cs
- rsa.cs
- HtmlLabelAdapter.cs
- CodeBlockBuilder.cs
- BaseCodePageEncoding.cs
- PropertyTabAttribute.cs
- SqlCachedBuffer.cs
- BCryptSafeHandles.cs
- nulltextcontainer.cs
- MaskedTextBox.cs
- PerfCounters.cs
- ExtendedPropertyCollection.cs
- propertytag.cs
- Grid.cs
- OutputCacheModule.cs
- SpellerHighlightLayer.cs
- IriParsingElement.cs
- DesignerDataColumn.cs
- ServiceOperation.cs
- CharacterShapingProperties.cs
- TemplateField.cs
- MenuItemAutomationPeer.cs
- RotateTransform3D.cs
- AssertSection.cs
- SuppressIldasmAttribute.cs
- ListViewTableCell.cs
- SqlDataSourceStatusEventArgs.cs
- RegexWorker.cs
- UserPreferenceChangingEventArgs.cs