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
- EmbeddedMailObjectsCollection.cs
- SimpleRecyclingCache.cs
- DataGridColumnCollection.cs
- ResourceProperty.cs
- SqlInternalConnectionSmi.cs
- PointLight.cs
- MemoryFailPoint.cs
- TemplateBindingExpressionConverter.cs
- XsdSchemaFileEditor.cs
- CompilerErrorCollection.cs
- ICspAsymmetricAlgorithm.cs
- HttpServerVarsCollection.cs
- SeparatorAutomationPeer.cs
- RetriableClipboard.cs
- AsymmetricKeyExchangeDeformatter.cs
- HtmlInputHidden.cs
- CompiledIdentityConstraint.cs
- LicenseProviderAttribute.cs
- BooleanAnimationUsingKeyFrames.cs
- CallSite.cs
- DataGridComponentEditor.cs
- MenuItem.cs
- FileNotFoundException.cs
- XmlIlTypeHelper.cs
- CommandExpr.cs
- CodeAccessSecurityEngine.cs
- CollaborationHelperFunctions.cs
- Int64.cs
- DBSqlParserTable.cs
- UIHelper.cs
- ListViewGroupItemCollection.cs
- Baml2006ReaderSettings.cs
- SmiContextFactory.cs
- ChannelServices.cs
- WindowsUpDown.cs
- Ref.cs
- PagePropertiesChangingEventArgs.cs
- PathStreamGeometryContext.cs
- PageVisual.cs
- RangeBase.cs
- EFDataModelProvider.cs
- HttpCookie.cs
- DrawListViewSubItemEventArgs.cs
- GridItem.cs
- NestedContainer.cs
- SamlAssertion.cs
- TypeResolver.cs
- DataGridViewSortCompareEventArgs.cs
- TextRangeSerialization.cs
- CqlGenerator.cs
- KeyboardNavigation.cs
- RecognizerStateChangedEventArgs.cs
- WebServiceMethodData.cs
- DataGridViewComboBoxColumn.cs
- TypeEnumerableViewSchema.cs
- TableItemStyle.cs
- ObjectManager.cs
- ContainsRowNumberChecker.cs
- HostedHttpContext.cs
- NonBatchDirectoryCompiler.cs
- StringAnimationUsingKeyFrames.cs
- FormViewDeletedEventArgs.cs
- ProgressPage.cs
- SystemDropShadowChrome.cs
- QueryResponse.cs
- VirtualizingPanel.cs
- UiaCoreApi.cs
- PaperSource.cs
- WriteableBitmap.cs
- ExportOptions.cs
- TailPinnedEventArgs.cs
- UriScheme.cs
- WebControl.cs
- ItemPager.cs
- InvalidComObjectException.cs
- SectionRecord.cs
- ClassImporter.cs
- LogEntry.cs
- AncestorChangedEventArgs.cs
- Error.cs
- InvalidWMPVersionException.cs
- FastPropertyAccessor.cs
- NamespaceList.cs
- SchemaEntity.cs
- MatrixStack.cs
- XmlTextReaderImpl.cs
- WebAdminConfigurationHelper.cs
- PropVariant.cs
- input.cs
- CharConverter.cs
- DecimalConstantAttribute.cs
- SrgsRulesCollection.cs
- ThousandthOfEmRealPoints.cs
- LicenseManager.cs
- SourceSwitch.cs
- AssemblyBuilder.cs
- PropertyMetadata.cs
- WebReference.cs
- ZeroOpNode.cs
- MetadataItemSerializer.cs