MemCacheClient::Server Class Reference

Abstraction of a server connection. More...

Inheritance diagram for MemCacheClient::Server:

ServerSocket

List of all members.

Public Member Functions

 Server ()
 constructor
 Server (const Server &rhs)
 copy constructor
 ~Server ()
 destructor
Serveroperator= (const Server &rhs)
 copy operator
bool operator== (const Server &rhs) const
 equality based on server listen address
bool operator!= (const Server &rhs) const
 inequality based on server listen address
bool Set (const char *a_pszServer)
 Set the listen address for this server.
bool Connect (int a_nTimeout)
 Attempt to connect to the server.
const char * GetAddress () const
 Get the string representation of this server listen address.

Private Attributes

char mAddress [ADDRLEN]
 server IP:PORT as string
unsigned long mIp
 server IP address
int mPort
 server port
time_t mLastConnect
 last connection time

Static Private Attributes

static const size_t ADDRLEN = sizeof("aaa.bbb.ccc.ddd:PPPPP")
 max length of a server address


Detailed Description

Abstraction of a server connection.

Definition at line 323 of file MemCacheClient.cpp.


Constructor & Destructor Documentation

MemCacheClient::Server::Server ( const Server rhs  )  [inline]

copy constructor

Parameters:
rhs server to copy address of

Definition at line 335 of file MemCacheClient.cpp.

References ServerSocket::operator=().


Member Function Documentation

MemCacheClient::Server & MemCacheClient::Server::operator= ( const Server rhs  ) 

copy operator

Parameters:
rhs server to copy server listen address from

Definition at line 386 of file MemCacheClient.cpp.

References mAddress, mIp, mLastConnect, and mPort.

bool MemCacheClient::Server::operator== ( const Server rhs  )  const

equality based on server listen address

Parameters:
rhs server to compare to
Returns:
true when servers are using the same listen address

Definition at line 398 of file MemCacheClient.cpp.

References mIp, and mPort.

bool MemCacheClient::Server::operator!= ( const Server rhs  )  const [inline]

inequality based on server listen address

Parameters:
rhs server to compare to
Returns:
true when servers are not using the same listen address

Definition at line 355 of file MemCacheClient.cpp.

bool MemCacheClient::Server::Set ( const char *  a_pszServer  ) 

Set the listen address for this server.

Parameters:
a_pszServer Listen address in IP:PORT format
Returns:
true if listen address was correctly parsed

Definition at line 406 of file MemCacheClient.cpp.

References ADDRLEN, mAddress, mIp, and mPort.

Referenced by MemCacheClient::AddServer(), MemCacheClient::DelServer(), and MemCacheClient::FlushAll().

bool MemCacheClient::Server::Connect ( int  a_nTimeout  ) 

Attempt to connect to the server.

Parameters:
a_nTimeout Timeout for connection in milliseconds
Returns:
true if connection was successful

Definition at line 434 of file MemCacheClient.cpp.

References ServerSocket::Connect(), ServerSocket::IsConnected(), MEMCACHECLIENT_RECONNECT_SEC, mIp, mLastConnect, and mPort.

Referenced by MemCacheClient::FindServer(), and MemCacheClient::FlushAll().

const char* MemCacheClient::Server::GetAddress (  )  const [inline]

Get the string representation of this server listen address.

This may not be the same as the address passed in. It will always be in the format IP:PORT.

Returns:
Server listen address as IP:PORT

Definition at line 376 of file MemCacheClient.cpp.

Referenced by MemCacheClient::AddServer().


The documentation for this class was generated from the following file:

Generated on Tue Jun 3 17:24:05 2008 for MemCacheClient by  doxygen 1.5.6