xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
XrdNetCache Class Reference

#include <XrdNetCache.hh>

Collaboration diagram for XrdNetCache:
Collaboration graph
[legend]

Classes

struct  anItem
 

Public Member Functions

void Add (XrdNetAddrInfo *hAddr, const char *hName)
 
char * Find (XrdNetAddrInfo *hAddr)
 
 XrdNetCache (int psize=987, int csize=1597)
 
 ~XrdNetCache ()
 

Static Public Member Functions

static void SetKT (int ktval)
 

Private Member Functions

void Expand ()
 
int GenKey (anItem &Item, XrdNetAddrInfo *hAddr)
 
anItemLocate (anItem &Item)
 

Private Attributes

XrdSysMutex myMutex
 
anItem ** nashtable
 
int prevtablesize
 
int nashtablesize
 
int nashnum
 
int Threshold
 

Static Private Attributes

static const int LoadMax = 80
 
static int keepTime
 

Constructor & Destructor Documentation

XrdNetCache::XrdNetCache ( int  psize = 987,
int  csize = 1597 
)

Constructor. When allocateing a new hash, two adjacent Fibonocci numbers. The series is simply n[j] = n[j-1] + n[j-2].

Parameters
psizethe correct Fibonocci antecedent to csize.
csizethe initial size of the table.
XrdNetCache::~XrdNetCache ( )
inline

Destructor. The XrdNetCache object is not designed to be deleted. Doing so will cause memory to be lost.

Member Function Documentation

void XrdNetCache::Add ( XrdNetAddrInfo hAddr,
const char *  hName 
)

Add an address-hostname association to the cache. The address must be an INET family address; otherwise it is not added.

Parameters
hAddrpoints to the address of the name.
hNamepoints to the name to be associated with the address.
void XrdNetCache::Expand ( )
private
char* XrdNetCache::Find ( XrdNetAddrInfo hAddr)

Locate an address-hostname association in the cache.

Parameters
hAddrpoints to the address of the name.
Returns
Success: an strdup'd string of the corresponding name. Failure: 0;
int XrdNetCache::GenKey ( anItem Item,
XrdNetAddrInfo hAddr 
)
private
anItem* XrdNetCache::Locate ( anItem Item)
private
static void XrdNetCache::SetKT ( int  ktval)
inlinestatic

Set the default keep time for entries in the cache during initialization.

Parameters
ktValthe number of seconds to keep an entry in the cache.

References keepTime.

Member Data Documentation

int XrdNetCache::keepTime
staticprivate

Referenced by SetKT().

const int XrdNetCache::LoadMax = 80
staticprivate
XrdSysMutex XrdNetCache::myMutex
private
int XrdNetCache::nashnum
private
anItem** XrdNetCache::nashtable
private
int XrdNetCache::nashtablesize
private
int XrdNetCache::prevtablesize
private
int XrdNetCache::Threshold
private

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