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
- Convert.cs
- iisPickupDirectory.cs
- StringUtil.cs
- HtmlHistory.cs
- RowsCopiedEventArgs.cs
- TdsParserSafeHandles.cs
- RefreshPropertiesAttribute.cs
- PlatformNotSupportedException.cs
- DataServiceProviderWrapper.cs
- HttpSocketManager.cs
- SqlUnionizer.cs
- Vertex.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- Transform.cs
- BamlResourceContent.cs
- RootAction.cs
- RSAPKCS1KeyExchangeFormatter.cs
- HMACSHA1.cs
- DecimalFormatter.cs
- SqlInfoMessageEvent.cs
- FontFaceLayoutInfo.cs
- GridEntry.cs
- NodeInfo.cs
- Translator.cs
- DeflateEmulationStream.cs
- EllipticalNodeOperations.cs
- CredentialCache.cs
- CreatingCookieEventArgs.cs
- util.cs
- GlobalizationAssembly.cs
- XmlQueryCardinality.cs
- CodeTypeParameterCollection.cs
- WindowsComboBox.cs
- StringFormat.cs
- TraceLevelStore.cs
- serverconfig.cs
- PersonalizationStateInfoCollection.cs
- Trace.cs
- EntityObject.cs
- BinHexDecoder.cs
- CharAnimationBase.cs
- DefaultHttpHandler.cs
- ContainerFilterService.cs
- TraversalRequest.cs
- SqlConnectionHelper.cs
- SoapParser.cs
- SecuritySessionSecurityTokenProvider.cs
- NativeMethods.cs
- SqlUserDefinedTypeAttribute.cs
- DataColumnPropertyDescriptor.cs
- AsyncOperation.cs
- XmlChoiceIdentifierAttribute.cs
- DBBindings.cs
- IgnoreSection.cs
- SafeMILHandleMemoryPressure.cs
- MeasurementDCInfo.cs
- TemplatedAdorner.cs
- DetailsViewUpdateEventArgs.cs
- _AutoWebProxyScriptWrapper.cs
- ProgressBarAutomationPeer.cs
- ListViewItemSelectionChangedEvent.cs
- DockAndAnchorLayout.cs
- PlainXmlDeserializer.cs
- PropertyMetadata.cs
- DBAsyncResult.cs
- regiisutil.cs
- BamlRecords.cs
- NotifyParentPropertyAttribute.cs
- DynamicRouteExpression.cs
- TextRangeSerialization.cs
- Permission.cs
- ListenerUnsafeNativeMethods.cs
- ProfilePropertyNameValidator.cs
- TextEffectCollection.cs
- RulePatternOps.cs
- SecurityResources.cs
- XPathExpr.cs
- ProcessModelSection.cs
- GeneralTransform3DGroup.cs
- EditingScopeUndoUnit.cs
- CopyAction.cs
- MouseGestureConverter.cs
- WindowsRebar.cs
- UnmanagedMemoryAccessor.cs
- WindowsStartMenu.cs
- QueryPageSettingsEventArgs.cs
- Message.cs
- TextTreeObjectNode.cs
- OdbcConnectionString.cs
- ConditionalAttribute.cs
- EntityKey.cs
- UrlMappingsSection.cs
- SqlCachedBuffer.cs
- TextEditorDragDrop.cs
- GlyphCache.cs
- GlobalizationSection.cs
- __ComObject.cs
- dtdvalidator.cs
- Documentation.cs
- DataGridViewCellLinkedList.cs