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
- TextReader.cs
- PageThemeBuildProvider.cs
- _SpnDictionary.cs
- QueryOutputWriterV1.cs
- FlowLayoutSettings.cs
- isolationinterop.cs
- Models.cs
- Focus.cs
- FormViewDeleteEventArgs.cs
- SqlTrackingQuery.cs
- _NegoStream.cs
- BaseTemplateParser.cs
- rsa.cs
- AuthenticationManager.cs
- Geometry3D.cs
- SqlServices.cs
- MatrixTransform.cs
- OracleLob.cs
- OdbcParameterCollection.cs
- ForeignKeyConstraint.cs
- Int32Rect.cs
- EmptyEnumerator.cs
- Collection.cs
- ErrorRuntimeConfig.cs
- DefaultObjectMappingItemCollection.cs
- SpecularMaterial.cs
- ViewManager.cs
- GlyphCollection.cs
- UserUseLicenseDictionaryLoader.cs
- Walker.cs
- FreezableOperations.cs
- ActivityPreviewDesigner.cs
- StringFormat.cs
- LogicalExpr.cs
- ListViewItemSelectionChangedEvent.cs
- EntityKeyElement.cs
- MergablePropertyAttribute.cs
- AnnotationResourceCollection.cs
- AutomationElement.cs
- BaseValidator.cs
- CSharpCodeProvider.cs
- AuthenticateEventArgs.cs
- Collection.cs
- _IPv6Address.cs
- StorageEntityContainerMapping.cs
- NullableDoubleSumAggregationOperator.cs
- EntityTransaction.cs
- DataReceivedEventArgs.cs
- CompositeTypefaceMetrics.cs
- AppSettingsExpressionEditor.cs
- XmlException.cs
- UInt16.cs
- IPipelineRuntime.cs
- InProcStateClientManager.cs
- SettingsPropertyCollection.cs
- CustomErrorCollection.cs
- QilFunction.cs
- QilChoice.cs
- LinkUtilities.cs
- followingquery.cs
- StopStoryboard.cs
- PolicyConversionContext.cs
- xmlsaver.cs
- HostExecutionContextManager.cs
- PrintDialogException.cs
- CommandHelpers.cs
- Adorner.cs
- SrgsGrammarCompiler.cs
- HttpValueCollection.cs
- DataService.cs
- XmlExtensionFunction.cs
- PanelStyle.cs
- CompiledQuery.cs
- XmlValidatingReader.cs
- EntityDataSourceSelectingEventArgs.cs
- ProfileServiceManager.cs
- CompoundFileDeflateTransform.cs
- HttpBufferlessInputStream.cs
- GeneralTransform3DTo2D.cs
- ControlPropertyNameConverter.cs
- XmlSiteMapProvider.cs
- DateTimeOffset.cs
- followingsibling.cs
- CustomWebEventKey.cs
- RootBrowserWindow.cs
- ProcessModelInfo.cs
- DirectoryObjectSecurity.cs
- AnimationException.cs
- AppearanceEditorPart.cs
- __Filters.cs
- TextViewElement.cs
- RecordConverter.cs
- PointLight.cs
- ValidationError.cs
- XmlTextReaderImplHelpers.cs
- ActivityExecutorOperation.cs
- XmlSchemaInfo.cs
- RepeatInfo.cs
- DataMisalignedException.cs
- Propagator.JoinPropagator.cs