Naanou.Common
Class KeyContainer

Holds a stored key, and keeps track of caching and key expiry

Field Summary
int Authority
         Authority level of store
double CACHE_MAX
int CACHE_RANGE
         Number of nodes keys are cached over
Naanou.Common.Search.IKey Data
         Data
Naanou.Common.KeyContainer Empty
         Empty key
long ExpireLength
         How many minutes key will expire in
long ExpireTime
         Expiry time (ticks)
Naanou.Common.Hash Id
         Id for key to be stored under
Naanou.Common.Hash InsertedBy
         Who inserted the key
long InsertTime
         Insertion time (ticks)
bool IsEmpty
         Is key empty
long LastCacheTime
         Expiry time (ticks)
long ReCacheTime
         Time (ticks) when cached version of this key should be recached

Constructor Summary
KeyContainer(Naanou.Common.Search.IKey data, Naanou.Common.Hash id, Naanou.Common.Hash insertedBy, long expire, int authority)
         Constructor
KeyContainer(bool empty)
         Empty constructor

Method Summary
void Added()
         Signals to key it has been added to storage. This will set the insert and expire times
void Cached()
         Signals to key that it has been cached. This will reset caching times
bool Equals(object o)
int GetHashCode()
bool IsExpired()
         Has the key expired
bool RequiresCaching()
         Checks whether key needs to be cached
string ToString()
         Gets a string representation of key

Methods inherited from class System.Object
Finalize, GetType, MemberwiseClone

Operator Summary
bool operator ==(Naanou.Common.KeyContainer x, Naanou.Common.KeyContainer y)
bool operator !=(Naanou.Common.KeyContainer x, Naanou.Common.KeyContainer y)


Field Detail

Authority

public int Authority

Authority level of store


CACHE_MAX

private double CACHE_MAX


CACHE_RANGE

public int CACHE_RANGE

Number of nodes keys are cached over


Data

public Naanou.Common.Search.IKey Data

Data


Empty

public Naanou.Common.KeyContainer Empty

Empty key


ExpireLength

public long ExpireLength

How many minutes key will expire in


ExpireTime

private long ExpireTime

Expiry time (ticks)


Id

public Naanou.Common.Hash Id

Id for key to be stored under


InsertedBy

public Naanou.Common.Hash InsertedBy

Who inserted the key


InsertTime

private long InsertTime

Insertion time (ticks)


IsEmpty

public bool IsEmpty

Is key empty


LastCacheTime

private long LastCacheTime

Expiry time (ticks)


ReCacheTime

private long ReCacheTime

Time (ticks) when cached version of this key should be recached

Constructor Detail

KeyContainer

public KeyContainer(Naanou.Common.Search.IKey data,
                    Naanou.Common.Hash id,
                    Naanou.Common.Hash insertedBy,
                    long expire,
                    int authority)

Constructor

Parameters:
data - Data
id - Id for key to be stored under
insertedBy - Inserted by (0 for anon)
expire - In how many minutes should key expire
authority - Authority (0 top-level)
Throws:
System.ArgumentNullException - A required parameter is null

KeyContainer

private KeyContainer(bool empty)

Empty constructor

Parameters:
empty - Good for nothing
Method Detail

Added

public void Added()

Signals to key it has been added to storage. This will set the insert and expire times


Cached

public void Cached()

Signals to key that it has been cached. This will reset caching times


Equals

public bool Equals(object o)


GetHashCode

public int GetHashCode()


IsExpired

public bool IsExpired()

Has the key expired

Returns:
Boolean indicating if key has expired

RequiresCaching

public bool RequiresCaching()

Checks whether key needs to be cached

Returns:
TRUE if requires caching

ToString

public string ToString()

Gets a string representation of key

Returns:
Operator Detail

Equality Operator

public bool operator ==(Naanou.Common.KeyContainer x,
                        Naanou.Common.KeyContainer y)


Inequality Operator

public bool operator !=(Naanou.Common.KeyContainer x,
                        Naanou.Common.KeyContainer y)