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
- MimeXmlReflector.cs
- InvalidAsynchronousStateException.cs
- NumericUpDownAcceleration.cs
- ScalarOps.cs
- GlobalProxySelection.cs
- TraceUtility.cs
- SafeFileMappingHandle.cs
- _ConnectionGroup.cs
- EntityDataSourceDataSelectionPanel.cs
- TemplateBuilder.cs
- ArgumentsParser.cs
- GridItemCollection.cs
- DropShadowBitmapEffect.cs
- SymbolPair.cs
- DescendantBaseQuery.cs
- CustomBindingElementCollection.cs
- HttpException.cs
- Lease.cs
- ListView.cs
- SharedHttpTransportManager.cs
- DataControlCommands.cs
- RoutedEventArgs.cs
- Documentation.cs
- RegexStringValidator.cs
- TreeNodeCollection.cs
- Comparer.cs
- CodeLinePragma.cs
- dataprotectionpermission.cs
- GreenMethods.cs
- ObjectViewEntityCollectionData.cs
- FloatUtil.cs
- RtfControls.cs
- listitem.cs
- SQLGuid.cs
- _IPv4Address.cs
- ExpressionLexer.cs
- StylusTip.cs
- SharedDp.cs
- InputLanguageCollection.cs
- DynamicRendererThreadManager.cs
- DataGridItemEventArgs.cs
- SingleAnimationUsingKeyFrames.cs
- StatusBarDrawItemEvent.cs
- Rectangle.cs
- RangeContentEnumerator.cs
- HotCommands.cs
- XmlSchemaInclude.cs
- LoginUtil.cs
- DataGridView.cs
- StreamUpdate.cs
- BasicDesignerLoader.cs
- CustomAttribute.cs
- login.cs
- OdbcStatementHandle.cs
- RsaKeyIdentifierClause.cs
- Mapping.cs
- SystemResourceHost.cs
- TreeViewEvent.cs
- ConditionCollection.cs
- DrawingDrawingContext.cs
- ResponseStream.cs
- UriTemplateTableMatchCandidate.cs
- WebPartAddingEventArgs.cs
- UIElementAutomationPeer.cs
- ErrorTableItemStyle.cs
- COM2IPerPropertyBrowsingHandler.cs
- XmlIgnoreAttribute.cs
- CodeValidator.cs
- DataGridRow.cs
- ConnectionPoint.cs
- HMACSHA1.cs
- TraceContextRecord.cs
- DataGridViewIntLinkedList.cs
- RolePrincipal.cs
- SkipStoryboardToFill.cs
- BamlCollectionHolder.cs
- Tuple.cs
- RemotingConfigParser.cs
- TcpClientCredentialType.cs
- TraceSource.cs
- DataKeyPropertyAttribute.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- odbcmetadatafactory.cs
- AddInDeploymentState.cs
- SafeArchiveContext.cs
- PrimitiveXmlSerializers.cs
- DefaultPrintController.cs
- ZoneButton.cs
- ConditionCollection.cs
- PartManifestEntry.cs
- XmlDeclaration.cs
- XmlSchemas.cs
- DeclarativeCatalogPart.cs
- CalendarDateRange.cs
- SamlAuthenticationClaimResource.cs
- InternalControlCollection.cs
- XmlIlVisitor.cs
- SchemaAttDef.cs
- ByteViewer.cs
- ThreadInterruptedException.cs