Table of Contents

Class CacheSessionContext

Namespace
Ranorex.Core
Assembly
Ranorex.Core.dll

Represents a scope wherein a Ranorex.Libs.CacheSession is active.

public class CacheSessionContext : IDisposable
Inheritance
CacheSessionContext
Implements
Inherited Members

Constructors

CacheSessionContext()

Creates a new context for a Ranorex.Libs.CacheSession.

public CacheSessionContext()

Remarks

All element operations from calling the constructor of a CacheSessionContext to calling the Dispose() method are cached in a Ranorex.Libs.CacheSession.

A new Ranorex.Libs.CacheSession is only constructed if there is no active Ranorex.Libs.CacheSession yet.

CacheSessionContext(bool)

Creates a new context for a Ranorex.Libs.CacheSession.

public CacheSessionContext(bool forceNew)

Parameters

forceNew bool

If set to true, the creation of a new Ranorex.Libs.CacheSession is forced.

Remarks

All element operations from calling the constructor of a CacheSessionContext to calling the Dispose() method are cached in a Ranorex.Libs.CacheSession.

If forceNew is false, a new Ranorex.Libs.CacheSession is only constructed if there is no active Ranorex.Libs.CacheSession yet.

Properties

IsActive

Gets a value indicating whether the current cache session is active.

public static bool IsActive { get; }

Property Value

bool

true if the current cache session is active; otherwise, false.

Remarks

Currently, only the default cache session is not active; i.e. this property only returns false if you currently not within a cache session context.

Methods

Dispose()

Disposes the current CacheSessionContext. If this context is the currently active CacheSessionContext, the new current context will be the context that has been replaced by this context.

public void Dispose()

~CacheSessionContext()

Disposes this context on finalize if Dispose() has not been called yet.

protected ~CacheSessionContext()

Set(object, object)

Sets the specified value in the cache for the specified key.

public static void Set(object key, object value)

Parameters

key object

The key.

value object

The value.

TryGetValue(object, out object)

Tries to get the value for the specified key from the cache.

public static bool TryGetValue(object key, out object value)

Parameters

key object

The key.

value object

When this method returns, contains the cached value for the specified key or null if the cache does not contain the specified key or the cache session is not active.

Returns

bool

true if the cache contained the specified key; otherwise false.