PeanutButter
Loading...
Searching...
No Matches
PeanutButter.TempRedis.TempRedis Class Reference

More...

Inheritance diagram for PeanutButter.TempRedis.TempRedis:
PeanutButter.TempRedis.ITempRedis

Public Member Functions

IConnectionMultiplexer Connect ()
 Provides a simple mechanism to open a connection to the redis instance.
Returns

IConnectionMultiplexer ConnectUnmanaged ()
 Provides a simple mechanism to connect to the redis instance with an unmanaged connection - you will be responsible for disposing of it.
Returns

IConnectionMultiplexer ConnectUnmanaged (ConfigurationOptions options)
 Provides a simple mechanism to connect to the redis instance with an unmanaged connection - you will be responsible for disposing of it.
Returns

void Reset ()
 Close all managed connections, restart the server, flush all data.
IConnectionMultiplexer Connect (ConfigurationOptions options)
 Connect to the redis instance with your own options.
Parameters
config
Returns

 TempRedis ()
 Constructs an instance of the temporary server, automatically started up and using redis-server as found in your PATH or via Windows service registry, where applicable; will attempt to download redis server on a windows host if not found in your path or as a service.
 TempRedis (TempRedisOptions options)
 Construct an instance of the temporary server.
void Stop ()
 Stops the redis server. You probably don't need to call this as the server will automatically be stopped when disposed.
void Restart ()
 Restarts the server process (shortcut for Stop/Start)
IDatabase ConnectAndSelectDatabase (int db)
 Creates a connection to the provided database.
Parameters
db
Returns

IEnumerable< string > FetchKeys ()
 Fetch all keys at the default database.
Returns

IEnumerable< string > FetchKeys (string matching)
 Fetch all keys matching.
Parameters
matching
Returns

Public Member Functions inherited from PeanutButter.TempRedis.ITempRedis
void Start ()
 Starts up the server, if not auto-started at construction time (default is to auto-start)
void Store< T > (string key, T value)
 Stores the value at the redis server.
Fetch< T > (string key)
 Attempts to fetch the value of the provided key.
string Fetch (string key)
 Attempts to fetch the value of the provided key.
bool TryFetch< T > (string key, out T result)
 Attempts to fetch the value of the provided key.
void FlushAll ()
 Flush all keys from the default database (0)

Properties

Process ServerProcess [get]
 For diagnostic purposes: monitor the actual server process.
int? ServerProcessId [get]
 When the server is running, this is an easy way to get at the PID; if you get null, it's not running.
bool ServerProcessIsRunning [get]
 Test if the server process is running. If we're in the middle of a restart, it's possible to get the exception "No process is associated with this object" when attempting to read HasExited off of the exposed ServerProcess.
int Port [get]
 The port this instance is listening on.
string RedisExecutable [get]
 The resolved path to redis-server (may be passed in as a constructor parameter if necessary)
bool IsRunning [get]
 Flag: true when the redis server is running.
bool IsDisposed [get]
 Exposes the internal disposed flag for reading.
static int DefaultConnectTimeoutMilliseconds = 2000 [get, set]
 Sets the default connect timeout for new instances of TempRedis.Connect() (2000)
static int DefaultConnectRetry = 15 [get, set]
 Sets the default connect retry count for new instances of TempRedis.Connect() (15)
static int DefaultAsyncTimeoutMilliseconds = 2000 [get, set]
 Sets the default async timeout for new instances of TempRedis.Connect() (2000)
static int DefaultSyncTimeoutMilliseconds = 2000 [get, set]
 Sets the default sync timeout for new instances of TempRedis.Connect() (2000)
RedisLocatorStrategies LocatorStrategies [get, set]
 Possible strategies for locating a redis server executable.
IDatabase DefaultDatabase [get]
 Database 0 - for simple store/retrieve operations.
IConnectionMultiplexer DefaultConnection [get]
 The default connection used for operations.

Detailed Description

Constructor & Destructor Documentation

◆ TempRedis()

PeanutButter.TempRedis.TempRedis.TempRedis ( TempRedisOptions options)

Construct an instance of the temporary server.

Parameters
options

Member Function Documentation

◆ Connect() [1/2]

IConnectionMultiplexer PeanutButter.TempRedis.TempRedis.Connect ( )

Provides a simple mechanism to open a connection to the redis instance.

Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ Connect() [2/2]

IConnectionMultiplexer PeanutButter.TempRedis.TempRedis.Connect ( ConfigurationOptions options)

Connect to the redis instance with your own options.

Parameters
config
Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ ConnectAndSelectDatabase()

IDatabase PeanutButter.TempRedis.TempRedis.ConnectAndSelectDatabase ( int db)

Creates a connection to the provided database.

Parameters
db
Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ ConnectUnmanaged() [1/2]

IConnectionMultiplexer PeanutButter.TempRedis.TempRedis.ConnectUnmanaged ( )

Provides a simple mechanism to connect to the redis instance with an unmanaged connection - you will be responsible for disposing of it.

Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ ConnectUnmanaged() [2/2]

IConnectionMultiplexer PeanutButter.TempRedis.TempRedis.ConnectUnmanaged ( ConfigurationOptions options)

Provides a simple mechanism to connect to the redis instance with an unmanaged connection - you will be responsible for disposing of it.

Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ FetchKeys() [1/2]

IEnumerable< string > PeanutButter.TempRedis.TempRedis.FetchKeys ( )

Fetch all keys at the default database.

Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ FetchKeys() [2/2]

IEnumerable< string > PeanutButter.TempRedis.TempRedis.FetchKeys ( string matching)

Fetch all keys matching.

Parameters
matching
Returns

Implements PeanutButter.TempRedis.ITempRedis.

◆ Reset()

void PeanutButter.TempRedis.TempRedis.Reset ( )

Close all managed connections, restart the server, flush all data.

Implements PeanutButter.TempRedis.ITempRedis.

◆ Restart()

void PeanutButter.TempRedis.TempRedis.Restart ( )

Restarts the server process (shortcut for Stop/Start)

Implements PeanutButter.TempRedis.ITempRedis.

◆ Stop()

void PeanutButter.TempRedis.TempRedis.Stop ( )

Stops the redis server. You probably don't need to call this as the server will automatically be stopped when disposed.

Implements PeanutButter.TempRedis.ITempRedis.

Property Documentation

◆ DefaultDatabase

IDatabase PeanutButter.TempRedis.TempRedis.DefaultDatabase
get

Database 0 - for simple store/retrieve operations.

Implements PeanutButter.TempRedis.ITempRedis.

◆ IsDisposed

bool PeanutButter.TempRedis.TempRedis.IsDisposed
get

Exposes the internal disposed flag for reading.

Implements PeanutButter.TempRedis.ITempRedis.

◆ IsRunning

bool PeanutButter.TempRedis.TempRedis.IsRunning
get

Flag: true when the redis server is running.

Implements PeanutButter.TempRedis.ITempRedis.

◆ LocatorStrategies

RedisLocatorStrategies PeanutButter.TempRedis.TempRedis.LocatorStrategies
getset

Possible strategies for locating a redis server executable.

Implements PeanutButter.TempRedis.ITempRedis.

◆ Port

int PeanutButter.TempRedis.TempRedis.Port
get

The port this instance is listening on.

Implements PeanutButter.TempRedis.ITempRedis.

◆ RedisExecutable

string PeanutButter.TempRedis.TempRedis.RedisExecutable
get

The resolved path to redis-server (may be passed in as a constructor parameter if necessary)

Implements PeanutButter.TempRedis.ITempRedis.

◆ ServerProcessId

int? PeanutButter.TempRedis.TempRedis.ServerProcessId
get

When the server is running, this is an easy way to get at the PID; if you get null, it's not running.

Implements PeanutButter.TempRedis.ITempRedis.


The documentation for this class was generated from the following file:
  • source/TempDb/PeanutButter.TempRedis/TempRedis.cs