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
- PageAsyncTaskManager.cs
- DbFunctionCommandTree.cs
- SqlCommandAsyncResult.cs
- DispatcherOperation.cs
- RegionData.cs
- rsa.cs
- FileFormatException.cs
- ServiceBuildProvider.cs
- SafeLibraryHandle.cs
- WeakReference.cs
- DropDownList.cs
- TableCell.cs
- SemanticValue.cs
- NativeMethods.cs
- ClientBuildManager.cs
- GridViewColumnHeader.cs
- SchemaMapping.cs
- MeasureItemEvent.cs
- AudioFormatConverter.cs
- SecurityPolicySection.cs
- SQLResource.cs
- Container.cs
- grammarelement.cs
- XPathNodeInfoAtom.cs
- AmbientLight.cs
- ExecutionEngineException.cs
- RequiredFieldValidator.cs
- activationcontext.cs
- AutomationProperties.cs
- UserPersonalizationStateInfo.cs
- XPathSingletonIterator.cs
- AxDesigner.cs
- DataRelation.cs
- Transform3DGroup.cs
- PropertyGroupDescription.cs
- ObjectStateManagerMetadata.cs
- CellCreator.cs
- LicFileLicenseProvider.cs
- ModuleBuilder.cs
- StructuredProperty.cs
- CreateUserWizardStep.cs
- MetadataSource.cs
- PointConverter.cs
- SchemaElementDecl.cs
- ExpressionsCollectionConverter.cs
- ObjectListItem.cs
- CodeSnippetExpression.cs
- FixUpCollection.cs
- CaseInsensitiveComparer.cs
- ClientBuildManager.cs
- IdentityManager.cs
- PointAnimationBase.cs
- PaintValueEventArgs.cs
- FilteredReadOnlyMetadataCollection.cs
- LogReserveAndAppendState.cs
- Page.cs
- ToolBar.cs
- BooleanStorage.cs
- SplineKeyFrames.cs
- XmlSerializableServices.cs
- TextWriter.cs
- XmlDeclaration.cs
- DllNotFoundException.cs
- Stackframe.cs
- Mappings.cs
- DocumentEventArgs.cs
- DataRow.cs
- TypeLoader.cs
- BooleanStorage.cs
- DataMisalignedException.cs
- RegexTree.cs
- TokenCreationException.cs
- DataGridRowAutomationPeer.cs
- ApplicationContext.cs
- _ContextAwareResult.cs
- CodeCompiler.cs
- SspiSafeHandles.cs
- ListViewItem.cs
- InvalidFilterCriteriaException.cs
- DetailsViewDeleteEventArgs.cs
- sqlinternaltransaction.cs
- DateTimeFormat.cs
- ToolStripSplitStackLayout.cs
- DataGridViewBand.cs
- HttpListener.cs
- DataSetSchema.cs
- ClientSettingsSection.cs
- XmlIncludeAttribute.cs
- TraceSource.cs
- EncodingNLS.cs
- TextWriterEngine.cs
- SizeIndependentAnimationStorage.cs
- PerSessionInstanceContextProvider.cs
- DoubleCollectionConverter.cs
- CodeLinePragma.cs
- DictionaryEditChange.cs
- MessageQueueInstaller.cs
- ErrorFormatterPage.cs
- ExternalDataExchangeService.cs
- Repeater.cs