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.
파일 보기 프로젝트 열기: xianrendzw/LightFramework.Net 1 사용 예제들

공개 메소드들

메소드 설명
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