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
- AllMembershipCondition.cs
- MailWriter.cs
- CaseExpr.cs
- ConfigXmlComment.cs
- ImageListImage.cs
- HttpConfigurationSystem.cs
- TimeSpan.cs
- LineBreak.cs
- Scheduler.cs
- HostedHttpRequestAsyncResult.cs
- InstanceKeyCollisionException.cs
- Mappings.cs
- RoleGroupCollection.cs
- InvalidDataContractException.cs
- DBSqlParserColumnCollection.cs
- SqlXml.cs
- EnumCodeDomSerializer.cs
- FilterableData.cs
- DataGridViewColumnEventArgs.cs
- XmlMembersMapping.cs
- MetadataReference.cs
- XmlDataContract.cs
- ToolStripItemCollection.cs
- DataSourceSelectArguments.cs
- Rotation3DAnimation.cs
- SecurityStateEncoder.cs
- InputChannelAcceptor.cs
- FontSizeConverter.cs
- TypeBuilder.cs
- TabletDevice.cs
- CollectionViewGroup.cs
- ResourceDisplayNameAttribute.cs
- CodeDomConfigurationHandler.cs
- DirectionalLight.cs
- CodeArrayCreateExpression.cs
- HwndSource.cs
- XmlQueryOutput.cs
- DesignerSerializerAttribute.cs
- DrawingAttributes.cs
- ServicePointManager.cs
- DataGridViewComboBoxCell.cs
- DatePickerTextBox.cs
- ObjectTag.cs
- CollectionEditor.cs
- IRCollection.cs
- IteratorFilter.cs
- TextCollapsingProperties.cs
- SmtpDigestAuthenticationModule.cs
- HttpPostedFile.cs
- Slider.cs
- ObjectDisposedException.cs
- MissingMethodException.cs
- BinaryQueryOperator.cs
- CompareValidator.cs
- XmlReflectionImporter.cs
- WindowsSpinner.cs
- MessageBox.cs
- HwndTarget.cs
- KeyFrames.cs
- SafePointer.cs
- IndentedWriter.cs
- GeometryCollection.cs
- XPathMultyIterator.cs
- PolicyLevel.cs
- PriorityChain.cs
- StdValidatorsAndConverters.cs
- UInt16Converter.cs
- XMLUtil.cs
- OpCellTreeNode.cs
- TableLayoutPanelCodeDomSerializer.cs
- HtmlContainerControl.cs
- PriorityItem.cs
- MissingSatelliteAssemblyException.cs
- ConstraintStruct.cs
- ChangeProcessor.cs
- FormsIdentity.cs
- List.cs
- HttpTransportSecurity.cs
- Char.cs
- DocumentReferenceCollection.cs
- BamlTreeMap.cs
- SafeCryptHandles.cs
- KnownBoxes.cs
- UriPrefixTable.cs
- SafeFileMappingHandle.cs
- ConfigurationStrings.cs
- ConstructorExpr.cs
- TypedTableHandler.cs
- ServiceHostingEnvironment.cs
- FontNamesConverter.cs
- HttpCacheVary.cs
- PasswordRecoveryAutoFormat.cs
- ConstrainedGroup.cs
- XPathItem.cs
- CustomAssemblyResolver.cs
- X509Certificate2Collection.cs
- VisualState.cs
- ExpressionBindings.cs
- OverrideMode.cs
- AddInDeploymentState.cs