Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Security / NegotiationTokenAuthenticatorStateCache.cs / 1 / NegotiationTokenAuthenticatorStateCache.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Security { using System; using System.ServiceModel; using System.Collections; using System.Runtime.InteropServices; using System.Threading; using System.Diagnostics; sealed class NegotiationTokenAuthenticatorStateCache: TimeBoundedCache where T : NegotiationTokenAuthenticatorState { static int lowWaterMark = 50; static TimeSpan purgingInterval = TimeSpan.FromMinutes(10); TimeSpan cachingSpan; public NegotiationTokenAuthenticatorStateCache(TimeSpan cachingSpan, int maximumCachedState) : base(lowWaterMark, maximumCachedState, null, PurgingMode.TimerBasedPurge, TimeSpan.FromTicks(cachingSpan.Ticks >> 2), true) { this.cachingSpan = cachingSpan; } public void AddState(string context, T state) { DateTime expirationTime = TimeoutHelper.Add(DateTime.UtcNow, this.cachingSpan); bool wasStateAdded = base.TryAddItem(context, state, expirationTime, false); if (!wasStateAdded) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new SecurityNegotiationException(SR.GetString(SR.NegotiationStateAlreadyPresent, context))); } } public T GetState(string context) { return (this.GetItem(context) as T); } public void RemoveState(string context) { this.TryRemoveItem(context); } protected override ArrayList OnQuotaReached(Hashtable cacheTable) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QuotaExceededException(SR.GetString(SR.CachedNegotiationStateQuotaReached, this.Capacity))); } protected override void OnRemove(object item) { ((IDisposable)item).Dispose(); base.OnRemove(item); } } } // 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
- XsdValidatingReader.cs
- Missing.cs
- PolicyStatement.cs
- FormViewDeletedEventArgs.cs
- InputMethodStateTypeInfo.cs
- HttpApplication.cs
- HttpCapabilitiesEvaluator.cs
- XmlNullResolver.cs
- WebEventCodes.cs
- BooleanExpr.cs
- StateDesigner.Helpers.cs
- DataKey.cs
- DATA_BLOB.cs
- SourceFileInfo.cs
- XmlReflectionMember.cs
- elementinformation.cs
- MetadataException.cs
- OpCellTreeNode.cs
- ResourceContainer.cs
- Ipv6Element.cs
- OracleException.cs
- PersonalizationProvider.cs
- UnhandledExceptionEventArgs.cs
- FileDialogCustomPlacesCollection.cs
- EditorBrowsableAttribute.cs
- CodePrimitiveExpression.cs
- ValidateNames.cs
- Util.cs
- ConditionalDesigner.cs
- IDispatchConstantAttribute.cs
- MailWebEventProvider.cs
- _IPv4Address.cs
- BrowserCapabilitiesFactoryBase.cs
- IsolatedStoragePermission.cs
- JsonFormatReaderGenerator.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- xamlnodes.cs
- TileBrush.cs
- RequestQueue.cs
- CfgSemanticTag.cs
- HandoffBehavior.cs
- AnonymousIdentificationSection.cs
- WindowsGraphics2.cs
- ResetableIterator.cs
- HtmlForm.cs
- Logging.cs
- ListViewPagedDataSource.cs
- PersonalizationAdministration.cs
- TypeConverterValueSerializer.cs
- DbConnectionPoolCounters.cs
- HyperLinkField.cs
- LocalizableAttribute.cs
- InkCanvasInnerCanvas.cs
- StringArrayConverter.cs
- WebBrowser.cs
- WindowsGraphics2.cs
- Route.cs
- WebDisplayNameAttribute.cs
- HttpMethodAttribute.cs
- TabControlEvent.cs
- DocumentXmlWriter.cs
- JoinSymbol.cs
- SQLInt64.cs
- TypeConverterAttribute.cs
- DataColumnCollection.cs
- CodeRegionDirective.cs
- RuntimeWrappedException.cs
- DescendantOverDescendantQuery.cs
- ContentPresenter.cs
- HandlerFactoryCache.cs
- SchemaTableOptionalColumn.cs
- DateTimeHelper.cs
- RoleService.cs
- ImageListUtils.cs
- CompositeScriptReferenceEventArgs.cs
- ClientRolePrincipal.cs
- WindowsStatusBar.cs
- SystemUnicastIPAddressInformation.cs
- XmlAnyAttributeAttribute.cs
- TrustLevel.cs
- MetadataException.cs
- ProfileBuildProvider.cs
- MembershipPasswordException.cs
- EnumerableRowCollectionExtensions.cs
- InvalidCastException.cs
- BaseDataBoundControl.cs
- StructuralType.cs
- EditorAttributeInfo.cs
- AsnEncodedData.cs
- BlockingCollection.cs
- ServiceModelExtensionElement.cs
- DataGridPagerStyle.cs
- ToolStripCodeDomSerializer.cs
- RemoteWebConfigurationHostStream.cs
- StaticResourceExtension.cs
- ValueSerializerAttribute.cs
- Int32CollectionValueSerializer.cs
- DispatcherOperation.cs
- ImpersonationOption.cs
- ProfileSection.cs