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
- ChameleonKey.cs
- OracleInfoMessageEventArgs.cs
- Cell.cs
- relpropertyhelper.cs
- AncillaryOps.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- SecurityRuntime.cs
- CodeParameterDeclarationExpressionCollection.cs
- DataGridViewCellStyle.cs
- BasicExpressionVisitor.cs
- Random.cs
- EncryptedPackage.cs
- ActiveXSerializer.cs
- SendingRequestEventArgs.cs
- Win32Native.cs
- ScaleTransform3D.cs
- InputReportEventArgs.cs
- LinkUtilities.cs
- BlockUIContainer.cs
- SamlDelegatingWriter.cs
- WpfPayload.cs
- UrlPropertyAttribute.cs
- MissingFieldException.cs
- cryptoapiTransform.cs
- CopyOnWriteList.cs
- HistoryEventArgs.cs
- DecryptRequest.cs
- DataSourceDesigner.cs
- Pair.cs
- DataBindingCollection.cs
- Baml2006KnownTypes.cs
- SortExpressionBuilder.cs
- TreeBuilder.cs
- hwndwrapper.cs
- RectConverter.cs
- AnnotationAuthorChangedEventArgs.cs
- WCFModelStrings.Designer.cs
- SQLConvert.cs
- MenuScrollingVisibilityConverter.cs
- PtsContext.cs
- ManagementObjectCollection.cs
- PostBackOptions.cs
- NavigationPropertyEmitter.cs
- ColorConverter.cs
- ControlBuilder.cs
- PreProcessInputEventArgs.cs
- FileLogRecordHeader.cs
- EncoderExceptionFallback.cs
- ToolStripLocationCancelEventArgs.cs
- EmbossBitmapEffect.cs
- EntityModelSchemaGenerator.cs
- RegionData.cs
- ActivityStatusChangeEventArgs.cs
- InkCanvasInnerCanvas.cs
- DesignerOptionService.cs
- RectIndependentAnimationStorage.cs
- typedescriptorpermissionattribute.cs
- PrintPreviewGraphics.cs
- HandledMouseEvent.cs
- TraceContextRecord.cs
- XmlDocumentFragment.cs
- SimpleMailWebEventProvider.cs
- LambdaCompiler.Generated.cs
- DateTimeFormatInfoScanner.cs
- XpsImageSerializationService.cs
- ObjectListShowCommandsEventArgs.cs
- SafeCryptoHandles.cs
- Msec.cs
- PresentationSource.cs
- Double.cs
- BooleanAnimationUsingKeyFrames.cs
- RecognitionResult.cs
- TripleDESCryptoServiceProvider.cs
- RoleManagerSection.cs
- TreePrinter.cs
- KeyValuePair.cs
- DefaultWorkflowSchedulerService.cs
- XmlElement.cs
- CharUnicodeInfo.cs
- TargetControlTypeCache.cs
- DocumentGridContextMenu.cs
- ToolStripArrowRenderEventArgs.cs
- MetaModel.cs
- BridgeDataRecord.cs
- MultiPartWriter.cs
- ToolStripSeparatorRenderEventArgs.cs
- GenericQueueSurrogate.cs
- KeyValueInternalCollection.cs
- Binding.cs
- FaultDesigner.cs
- COM2ComponentEditor.cs
- BindingBase.cs
- ActivityExecutorSurrogate.cs
- FormsAuthenticationConfiguration.cs
- WebReferencesBuildProvider.cs
- DynamicDiscoSearcher.cs
- InplaceBitmapMetadataWriter.cs
- Utilities.cs
- MsmqIntegrationProcessProtocolHandler.cs
- DomainUpDown.cs