MemCacheClient
Classes | Public Member Functions | Public Attributes | Private Member Functions

MemCacheClient::ConsistentHash Struct Reference

Maintain the N:1 hash key to server relationship used for consistent hashing. More...

List of all members.

Classes

struct  MatchServer

Public Member Functions

 ConsistentHash (unsigned long aHash, Server *aServer, unsigned aServices, int aEntry)
 ConsistentHash (const ConsistentHash &rhs)
ConsistentHashoperator= (const ConsistentHash &rhs)
bool services (unsigned aService)
bool operator< (const ConsistentHash &rhs) const

Public Attributes

unsigned long mHash
 hash value
ServermServer
 server implementation
unsigned mServices
 services this server provides
int mEntry
 distinguish same hash and server

Private Member Functions

bool operator== (const ConsistentHash &rhs) const

Detailed Description

Maintain the N:1 hash key to server relationship used for consistent hashing.

Consistent hashing for the servers ensures that even with changes to the server list, many of the data keys will continue to mapped to the same server. This ensures that changes to the server list doesn't invalidate all cached data.

Definition at line 562 of file MemCacheClient.h.


Constructor & Destructor Documentation

MemCacheClient::ConsistentHash::ConsistentHash ( unsigned long  aHash,
Server aServer,
unsigned  aServices,
int  aEntry 
) [inline]

constructor

Definition at line 569 of file MemCacheClient.h.

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

copy constructor

Definition at line 572 of file MemCacheClient.h.


Member Function Documentation

bool MemCacheClient::ConsistentHash::operator< ( const ConsistentHash rhs) const

comparison on hash value

Definition at line 213 of file MemCacheClient.cpp.

References MemCacheClient::Server::GetAddress(), mEntry, mHash, mServer, and MemCacheClient::mServer.

ConsistentHash& MemCacheClient::ConsistentHash::operator= ( const ConsistentHash rhs) [inline]

copy

Definition at line 574 of file MemCacheClient.h.

References mEntry, mHash, mServer, and mServices.

bool MemCacheClient::ConsistentHash::services ( unsigned  aService) [inline]

does this server handle the required service?

Definition at line 579 of file MemCacheClient.h.


The documentation for this struct was generated from the following files: