C# Класс Whalin.Caching.Memcached.SockIOPool

This class is a connection sockIOPool for maintaning a sockIOPool of persistent connections to memcached servers. The sockIOPool must be initialized prior to use. This should typically be early on in the lifecycle of the application instance.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GetSock ( string key ) : SockIO

Returns appropriate SockIO object given string cache key.

GetSock ( string key, object hashCode ) : SockIO

Returns appropriate SockIO object given string cache key and optional hashcode. Trys to get SockIO from sockIOPool. Fails over to additional pools in event of server failure.

SetServers ( ArrayList servers ) : void

Sets the list of all cache servers

SetServers ( string servers ) : void

Sets the list of all cache servers

SetWeights ( ArrayList weights ) : void

sets the list of weights to apply to the server list

SetWeights ( int weights ) : void

sets the list of weights to apply to the server list

Защищенные методы

Метод Описание
AddSocketToPool ( Hashtable pool, string host, SockIO socket ) : void

Adds a socket to a given sockIOPool for the given host. Internal utility method.

ClosePool ( Hashtable pool ) : void

Closes all sockets in the passed in sockIOPool. Internal utility method.

CreateSocket ( string host ) : SockIO

Creates a new SockIO obj for the given server. If server fails to connect, then return null and do not try again until a duration has passed. This duration will grow by doubling after each failed attempt to connect.

SockIOPool ( ) : System

Приватные методы

Метод Описание
CheckIn ( SockIO socket ) : void
CheckIn ( SockIO socket, bool addToAvail ) : void
ClearHostFromPool ( Hashtable pool, string host ) : void
GetConnection ( string host ) : SockIO
GetInstance ( ) : SockIOPool
GetInstance ( String poolName ) : SockIOPool
GetLocalizedString ( string key ) : string
Initialize ( ) : void
NewHashingAlgorithm ( string key ) : int

Internal private hashing method. This is the new hashing algorithm from other clients. Found to be fast and have very good distribution. UPDATE: this is dog slow under java. Maybe under .NET?

OriginalHashingAlgorithm ( string key ) : int

Internal private hashing method. This is the original hashing algorithm from other clients. Found to be slow and have poor distribution.

RemoveSocketFromPool ( Hashtable pool, string host, SockIO socket ) : void
SelfMaintain ( ) : void
Shutdown ( ) : void
StartMaintenanceThread ( ) : void
StopMaintenanceThread ( ) : void

Описание методов

AddSocketToPool() защищенный статический Метод

Adds a socket to a given sockIOPool for the given host. Internal utility method.
protected static AddSocketToPool ( Hashtable pool, string host, SockIO socket ) : void
pool System.Collections.Hashtable
host string host this socket is connected to
socket SockIO socket to add
Результат void

ClosePool() защищенный статический Метод

Closes all sockets in the passed in sockIOPool. Internal utility method.
protected static ClosePool ( Hashtable pool ) : void
pool System.Collections.Hashtable
Результат void

CreateSocket() защищенный Метод

Creates a new SockIO obj for the given server. If server fails to connect, then return null and do not try again until a duration has passed. This duration will grow by doubling after each failed attempt to connect.
protected CreateSocket ( string host ) : SockIO
host string host:port to connect to
Результат SockIO

GetSock() публичный Метод

Returns appropriate SockIO object given string cache key.
public GetSock ( string key ) : SockIO
key string hashcode for cache key
Результат SockIO

GetSock() публичный Метод

Returns appropriate SockIO object given string cache key and optional hashcode. Trys to get SockIO from sockIOPool. Fails over to additional pools in event of server failure.
public GetSock ( string key, object hashCode ) : SockIO
key string hashcode for cache key
hashCode object if not null, then the int hashcode to use
Результат SockIO

SetServers() публичный Метод

Sets the list of all cache servers
public SetServers ( ArrayList servers ) : void
servers System.Collections.ArrayList string array of servers [host:port]
Результат void

SetServers() публичный Метод

Sets the list of all cache servers
public SetServers ( string servers ) : void
servers string string array of servers [host:port]
Результат void

SetWeights() публичный Метод

sets the list of weights to apply to the server list
public SetWeights ( ArrayList weights ) : void
weights System.Collections.ArrayList /// This is an int array with each element corresponding to an element /// in the same position in the server string array Servers. ///
Результат void

SetWeights() публичный Метод

sets the list of weights to apply to the server list
public SetWeights ( int weights ) : void
weights int /// This is an int array with each element corresponding to an element /// in the same position in the server string array Servers. ///
Результат void

SockIOPool() защищенный Метод

protected SockIOPool ( ) : System
Результат System