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
- DataServiceHostFactory.cs
- KeyGesture.cs
- DataServiceClientException.cs
- RSACryptoServiceProvider.cs
- CalendarDayButton.cs
- TextRunCache.cs
- UniqueIdentifierService.cs
- Imaging.cs
- BatchParser.cs
- WindowsRegion.cs
- TransformedBitmap.cs
- HtmlInputButton.cs
- RsaSecurityTokenAuthenticator.cs
- followingquery.cs
- PagesSection.cs
- HostingEnvironmentWrapper.cs
- ToolStripPanel.cs
- DateTimeUtil.cs
- StatusBarPanelClickEvent.cs
- CharAnimationBase.cs
- ChannelBase.cs
- XmlDomTextWriter.cs
- DataChangedEventManager.cs
- BoundColumn.cs
- cryptoapiTransform.cs
- SafeSecurityHelper.cs
- SmiContext.cs
- CallId.cs
- XpsThumbnail.cs
- CategoryAttribute.cs
- ProviderSettingsCollection.cs
- TableLayoutSettings.cs
- TabletDevice.cs
- WmlLabelAdapter.cs
- CompiledELinqQueryState.cs
- CustomValidator.cs
- SolidColorBrush.cs
- backend.cs
- TrustLevel.cs
- RectangleF.cs
- RepeatButton.cs
- Trace.cs
- ReadWriteSpinLock.cs
- ProgressBarAutomationPeer.cs
- EntitySqlQueryCacheEntry.cs
- ProgressBarHighlightConverter.cs
- WindowsRebar.cs
- RuleProcessor.cs
- Highlights.cs
- WindowsGraphicsWrapper.cs
- TokenBasedSetEnumerator.cs
- FieldTemplateFactory.cs
- SortQuery.cs
- MailSettingsSection.cs
- HelpProvider.cs
- RecognizerBase.cs
- DayRenderEvent.cs
- MonikerUtility.cs
- SoapExtensionStream.cs
- Converter.cs
- ByeMessageApril2005.cs
- SqlRowUpdatedEvent.cs
- BindingExpressionBase.cs
- IndentTextWriter.cs
- NonParentingControl.cs
- ProfileEventArgs.cs
- SqlConnectionHelper.cs
- RegexMatchCollection.cs
- TableLayoutPanel.cs
- DeflateStreamAsyncResult.cs
- AssemblyName.cs
- StreamDocument.cs
- storepermissionattribute.cs
- DiffuseMaterial.cs
- FormCollection.cs
- InvalidCommandTreeException.cs
- AliasedSlot.cs
- SHA256Managed.cs
- SqlGenericUtil.cs
- DesignTimeParseData.cs
- Matrix3DStack.cs
- ResourceManagerWrapper.cs
- Constants.cs
- StrokeDescriptor.cs
- util.cs
- ConcurrentBag.cs
- EventDescriptor.cs
- DebuggerAttributes.cs
- ObjectHelper.cs
- RelatedImageListAttribute.cs
- ReadWriteSpinLock.cs
- CompoundFileReference.cs
- ClientTargetSection.cs
- GridViewDeleteEventArgs.cs
- CellParagraph.cs
- TableCellsCollectionEditor.cs
- UrlPath.cs
- WorkflowInlining.cs
- EventLogger.cs
- ThousandthOfEmRealDoubles.cs