Code:
/ DotNET / DotNET / 8.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
- IndexedSelectQueryOperator.cs
- DataRecordObjectView.cs
- PackageRelationship.cs
- ObjectDataSourceDisposingEventArgs.cs
- Positioning.cs
- UnsafeMethods.cs
- EllipseGeometry.cs
- SpellCheck.cs
- Latin1Encoding.cs
- CompilerScopeManager.cs
- TypeGeneratedEventArgs.cs
- StyleTypedPropertyAttribute.cs
- assertwrapper.cs
- BamlCollectionHolder.cs
- GradientStop.cs
- PreservationFileWriter.cs
- HttpListenerTimeoutManager.cs
- WmlValidatorAdapter.cs
- NameValueCache.cs
- XmlSchemaObjectTable.cs
- MessageDescription.cs
- DeadCharTextComposition.cs
- PersonalizationAdministration.cs
- SqlConnectionFactory.cs
- MSHTMLHostUtil.cs
- MulticastNotSupportedException.cs
- DiscardableAttribute.cs
- JournalEntryListConverter.cs
- ConfigXmlComment.cs
- ModelServiceImpl.cs
- XmlSchemaInclude.cs
- IdentityHolder.cs
- InfoCardService.cs
- CharEnumerator.cs
- MediaContextNotificationWindow.cs
- ProcessHostMapPath.cs
- IncrementalReadDecoders.cs
- FixedSOMImage.cs
- MapPathBasedVirtualPathProvider.cs
- ExtenderControl.cs
- StringSorter.cs
- WindowsListViewScroll.cs
- NotConverter.cs
- CommonProperties.cs
- TickBar.cs
- XmlByteStreamReader.cs
- PolicyLevel.cs
- FileEnumerator.cs
- FtpCachePolicyElement.cs
- Normalization.cs
- X509Certificate.cs
- printdlgexmarshaler.cs
- Certificate.cs
- Screen.cs
- TypeDescriptorFilterService.cs
- UIPropertyMetadata.cs
- ConfigurationManagerInternal.cs
- mda.cs
- AdapterUtil.cs
- Socket.cs
- EdmItemError.cs
- EdmRelationshipRoleAttribute.cs
- XamlSerializerUtil.cs
- SecurityContextSecurityTokenAuthenticator.cs
- WizardStepBase.cs
- NodeFunctions.cs
- BindingOperations.cs
- CompiledAction.cs
- ContentElement.cs
- x509store.cs
- EntityCollection.cs
- NotifyIcon.cs
- ReadOnlyMetadataCollection.cs
- XmlWellformedWriterHelpers.cs
- XmlElement.cs
- DataRecord.cs
- XmlSchemaObject.cs
- UnsafeNativeMethodsPenimc.cs
- TagPrefixCollection.cs
- InternalConfigRoot.cs
- LinearKeyFrames.cs
- PaintValueEventArgs.cs
- BitmapEffectGroup.cs
- DrawingDrawingContext.cs
- DispatcherHooks.cs
- HostingEnvironmentException.cs
- TextPenaltyModule.cs
- OneOfScalarConst.cs
- NamedObject.cs
- RepeatInfo.cs
- ActiveXContainer.cs
- CapabilitiesPattern.cs
- ViewEvent.cs
- SatelliteContractVersionAttribute.cs
- XmlDictionaryWriter.cs
- ReflectionPermission.cs
- ContentType.cs
- SendAgentStatusRequest.cs
- InputManager.cs
- LocalBuilder.cs