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
- ErrorHandlingReceiver.cs
- ParentUndoUnit.cs
- ProfessionalColorTable.cs
- ContextMenuService.cs
- HtmlInputRadioButton.cs
- DeflateStream.cs
- VirtualPath.cs
- GridViewEditEventArgs.cs
- TableStyle.cs
- MouseActionConverter.cs
- PeerInputChannel.cs
- ParameterExpression.cs
- GenericEnumerator.cs
- Byte.cs
- UserPersonalizationStateInfo.cs
- Helper.cs
- X509CertificateValidator.cs
- EntityDataSourceChangedEventArgs.cs
- Comparer.cs
- XmlException.cs
- IsolatedStorageFile.cs
- UnmanagedMarshal.cs
- IndentedWriter.cs
- CommonGetThemePartSize.cs
- ModuleBuilder.cs
- TimersDescriptionAttribute.cs
- Calendar.cs
- UnsafeNativeMethods.cs
- DictionarySectionHandler.cs
- AutomationPatternInfo.cs
- ViewCellSlot.cs
- PolicyManager.cs
- PartitionerStatic.cs
- OpenTypeCommon.cs
- safex509handles.cs
- DesignerActionMethodItem.cs
- Int32KeyFrameCollection.cs
- OutputCacheSection.cs
- ToolStripDropDownItemDesigner.cs
- ProviderConnectionPoint.cs
- DnsPermission.cs
- Point3DAnimationBase.cs
- EasingKeyFrames.cs
- IisTraceListener.cs
- XmlDictionaryReader.cs
- MailAddress.cs
- oledbconnectionstring.cs
- ZipArchive.cs
- InputBinding.cs
- PolyQuadraticBezierSegment.cs
- DataGridViewElement.cs
- BulletedList.cs
- DataTablePropertyDescriptor.cs
- EmptyEnumerator.cs
- XmlCharType.cs
- DockPatternIdentifiers.cs
- ListBoxChrome.cs
- EntitySqlQueryCacheEntry.cs
- QilGenerator.cs
- NavigationProperty.cs
- EmptyCollection.cs
- XmlLanguageConverter.cs
- LogConverter.cs
- SudsWriter.cs
- MetadataImporterQuotas.cs
- SyntaxCheck.cs
- AsyncCodeActivityContext.cs
- HighlightComponent.cs
- WebPartActionVerb.cs
- KeyValuePair.cs
- AssemblyBuilderData.cs
- ValidationRuleCollection.cs
- MemberProjectedSlot.cs
- ArgIterator.cs
- Timeline.cs
- ValueUtilsSmi.cs
- CalendarButtonAutomationPeer.cs
- XmlNodeList.cs
- ExpressionBindingCollection.cs
- UserControlBuildProvider.cs
- IResourceProvider.cs
- SByteConverter.cs
- SequenceDesignerAccessibleObject.cs
- HelpInfo.cs
- DBSqlParser.cs
- Command.cs
- XhtmlCssHandler.cs
- IpcChannelHelper.cs
- RsaEndpointIdentity.cs
- NonSerializedAttribute.cs
- HGlobalSafeHandle.cs
- DataGridViewCellStyle.cs
- UserNameSecurityToken.cs
- ISAPIWorkerRequest.cs
- WebPartDisplayModeEventArgs.cs
- NameSpaceEvent.cs
- TreePrinter.cs
- ManagementNamedValueCollection.cs
- Group.cs
- TypeConstant.cs