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
- MailDefinition.cs
- JournalEntryStack.cs
- ComboBoxAutomationPeer.cs
- Soap.cs
- FontStretches.cs
- DiagnosticsConfigurationHandler.cs
- TypeConverterValueSerializer.cs
- AutomationPeer.cs
- ScriptBehaviorDescriptor.cs
- CodeNamespaceCollection.cs
- DesignerAutoFormatStyle.cs
- SupportingTokenSpecification.cs
- HtmlListAdapter.cs
- PopupRootAutomationPeer.cs
- TextSearch.cs
- InitiatorServiceModelSecurityTokenRequirement.cs
- FormViewUpdatedEventArgs.cs
- XmlMessageFormatter.cs
- XmlText.cs
- XmlILAnnotation.cs
- Splitter.cs
- StreamGeometryContext.cs
- SymbolEqualComparer.cs
- BaseComponentEditor.cs
- DefaultValidator.cs
- ISCIIEncoding.cs
- While.cs
- Line.cs
- BamlTreeMap.cs
- WindowsIdentity.cs
- CodeGotoStatement.cs
- WpfMemberInvoker.cs
- AnonymousIdentificationSection.cs
- Subtract.cs
- ConfigurationSettings.cs
- AttributeData.cs
- Component.cs
- SpeechRecognitionEngine.cs
- BaseTypeViewSchema.cs
- Invariant.cs
- SHA1Cng.cs
- IUnknownConstantAttribute.cs
- CfgParser.cs
- MonthChangedEventArgs.cs
- Deflater.cs
- _SSPISessionCache.cs
- TemplateKeyConverter.cs
- InputQueue.cs
- GridViewCancelEditEventArgs.cs
- XmlReflectionImporter.cs
- InkPresenterAutomationPeer.cs
- PrimitiveCodeDomSerializer.cs
- LiteralText.cs
- GenericPrincipal.cs
- XmlAttributes.cs
- ConfigXmlAttribute.cs
- ThreadBehavior.cs
- NullReferenceException.cs
- HybridObjectCache.cs
- SchemaMapping.cs
- FilteredDataSetHelper.cs
- BitSet.cs
- CacheMemory.cs
- DecimalConstantAttribute.cs
- SettingsSavedEventArgs.cs
- OracleEncoding.cs
- DataObjectAttribute.cs
- NumberSubstitution.cs
- DataGridColumnHeadersPresenter.cs
- CompareValidator.cs
- DataViewManager.cs
- CheckBoxField.cs
- SessionPageStatePersister.cs
- ArgumentOutOfRangeException.cs
- SplashScreenNativeMethods.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- XmlSchemaAll.cs
- ApplicationServiceManager.cs
- DesignerAttribute.cs
- ConstrainedDataObject.cs
- PageRequestManager.cs
- AttachedPropertiesService.cs
- RawMouseInputReport.cs
- FileStream.cs
- SharedRuntimeState.cs
- SynchronizedInputPattern.cs
- PropertyInfoSet.cs
- MatrixTransform.cs
- SizeF.cs
- Msmq4PoisonHandler.cs
- BaseProcessProtocolHandler.cs
- QueueProcessor.cs
- ProxyWebPartManager.cs
- DataListCommandEventArgs.cs
- GeometryGroup.cs
- DataExpression.cs
- AsymmetricKeyExchangeDeformatter.cs
- MetaForeignKeyColumn.cs
- RequestCachePolicy.cs