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
- Control.cs
- SubpageParagraph.cs
- TextPatternIdentifiers.cs
- ellipse.cs
- MouseDevice.cs
- RepeaterItem.cs
- GridViewEditEventArgs.cs
- HorizontalAlignConverter.cs
- EventMappingSettingsCollection.cs
- SchemaExporter.cs
- RangeValueProviderWrapper.cs
- WindowsComboBox.cs
- NetMsmqSecurityElement.cs
- ColumnMapCopier.cs
- RowCache.cs
- UIElementPropertyUndoUnit.cs
- DataBoundControlHelper.cs
- SystemIPGlobalStatistics.cs
- HitTestWithPointDrawingContextWalker.cs
- SizeValueSerializer.cs
- EntityCodeGenerator.cs
- QueryStringConverter.cs
- SchemaImporterExtensionElementCollection.cs
- NotImplementedException.cs
- xsdvalidator.cs
- XomlCompilerHelpers.cs
- MetabaseServerConfig.cs
- SchemaAttDef.cs
- DoubleCollection.cs
- SAPIEngineTypes.cs
- DbExpressionVisitor.cs
- Point3DAnimationBase.cs
- RegexGroupCollection.cs
- Interlocked.cs
- AssemblyName.cs
- InlineUIContainer.cs
- ListSortDescriptionCollection.cs
- MasterPageParser.cs
- Floater.cs
- ServiceOperationParameter.cs
- WeakReferenceList.cs
- RadioButtonStandardAdapter.cs
- RequestCacheManager.cs
- FormsAuthenticationModule.cs
- PersonalizationAdministration.cs
- SqlDataSourceSelectingEventArgs.cs
- DecimalConstantAttribute.cs
- ProjectionCamera.cs
- HttpDebugHandler.cs
- TdsParameterSetter.cs
- CollectionChange.cs
- ProcessInfo.cs
- AccessorTable.cs
- cache.cs
- SqlRemoveConstantOrderBy.cs
- ADMembershipProvider.cs
- ElementMarkupObject.cs
- TemplatedWizardStep.cs
- ReadWriteObjectLock.cs
- PeerApplication.cs
- KeyFrames.cs
- CodeDirectoryCompiler.cs
- DataPointer.cs
- EditorAttribute.cs
- SmiEventSink.cs
- TextEndOfLine.cs
- FindProgressChangedEventArgs.cs
- ResponseStream.cs
- StandardTransformFactory.cs
- ObjectStateFormatter.cs
- BitmapEffectOutputConnector.cs
- DesignerCatalogPartChrome.cs
- TextWriter.cs
- PolyLineSegment.cs
- DesignUtil.cs
- ColumnResult.cs
- ClientOperationFormatterProvider.cs
- Version.cs
- UnmanagedMemoryStreamWrapper.cs
- Security.cs
- TimelineGroup.cs
- ActivationServices.cs
- CopyAction.cs
- AssociationTypeEmitter.cs
- PerformanceCounterPermission.cs
- MouseGesture.cs
- Schema.cs
- XslTransform.cs
- LabelLiteral.cs
- filewebrequest.cs
- TextBlockAutomationPeer.cs
- CaseInsensitiveHashCodeProvider.cs
- WpfPayload.cs
- EncryptedKey.cs
- ServiceElementCollection.cs
- FrameDimension.cs
- DataTablePropertyDescriptor.cs
- _AuthenticationState.cs
- DataGridCaption.cs
- dtdvalidator.cs