TreeFrogFramework  2.8
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
TSharedMemoryKvs Class Reference

#include <tsharedmemorykvs.h>

Classes

class  Bucket
 
class  WriteLockingIterator
 

Public Member Functions

 TSharedMemoryKvs ()
 
 ~TSharedMemoryKvs ()
 
QByteArray get (const QByteArray &key)
 
bool set (const QByteArray &key, const QByteArray &value, int seconds)
 
bool remove (const QByteArray &key)
 
uint count () const
 
uint tableSize () const
 
void clear ()
 
void gc ()
 
float loadFactor () const
 
void rehash ()
 
bool lockForRead ()
 
bool lockForWrite ()
 
bool unlock ()
 
WriteLockingIterator begin ()
 
WriteLockingIterator end ()
 
void cleanup ()
 

Static Public Member Functions

static bool initialize (const QString &name, const QString &options)
 

Protected Member Functions

uint find (const QByteArray &key, Bucket &bucket) const
 
bool find (uint index, Bucket &bucket) const
 
int searchIndex (int first)
 
uint index (const QByteArray &key) const
 
uint next (uint index) const
 
void remove (uint index)
 

Friends

class TCacheSharedMemoryStore
 

Detailed Description

The TSharedMemoryKvs class provides a means of operating a in-memory KVS built in the server process.

Constructor & Destructor Documentation

◆ TSharedMemoryKvs()

TSharedMemoryKvs::TSharedMemoryKvs ( )

Constructs a TSharedMemoryKvs object.

◆ ~TSharedMemoryKvs()

TSharedMemoryKvs::~TSharedMemoryKvs ( )

Destructor.

Member Function Documentation

◆ begin()

TSharedMemoryKvs::WriteLockingIterator TSharedMemoryKvs::begin ( )

Locks the attached shared-memory segment for writing by this process and returns an STL-style iterator pointing to the first item in the KVS.

See also
class WriteLockingIterator

◆ cleanup()

void TSharedMemoryKvs::cleanup ( )

Cleanup the KVS.

◆ clear()

void TSharedMemoryKvs::clear ( )

Removes all items from the KVS.

◆ count()

uint TSharedMemoryKvs::count ( ) const

Returns the number of items set.

◆ end()

TSharedMemoryKvs::WriteLockingIterator TSharedMemoryKvs::end ( )

Returns an STL-style iterator pointing just after the last item in the KVS.

See also
class WriteLockingIterator

◆ find() [1/2]

uint TSharedMemoryKvs::find ( const QByteArray &  key,
Bucket bucket 
) const
protected

◆ find() [2/2]

bool TSharedMemoryKvs::find ( uint  index,
Bucket bucket 
) const
protected

◆ gc()

void TSharedMemoryKvs::gc ( )

Executes garbage collection.

◆ get()

QByteArray TSharedMemoryKvs::get ( const QByteArray &  key)

Returns the value associated with the key; otherwise returns an empty byte array.

◆ index()

uint TSharedMemoryKvs::index ( const QByteArray &  key) const
protected

◆ initialize()

bool TSharedMemoryKvs::initialize ( const QString &  name,
const QString &  options 
)
static

Initializes in-memory KVS with the given name and options.

◆ loadFactor()

float TSharedMemoryKvs::loadFactor ( ) const

◆ lockForRead()

bool TSharedMemoryKvs::lockForRead ( )

Locks the shared memory segment for reading by this process.

◆ lockForWrite()

bool TSharedMemoryKvs::lockForWrite ( )

Locks the shared memory segment for writing by this process.

◆ next()

uint TSharedMemoryKvs::next ( uint  index) const
protected

◆ rehash()

void TSharedMemoryKvs::rehash ( )

Internal use.

◆ remove() [1/2]

bool TSharedMemoryKvs::remove ( const QByteArray &  key)

Removes the specified key.

A key is ignored if it does not exist.

◆ remove() [2/2]

void TSharedMemoryKvs::remove ( uint  index)
protected

◆ searchIndex()

int TSharedMemoryKvs::searchIndex ( int  first)
protected

◆ set()

bool TSharedMemoryKvs::set ( const QByteArray &  key,
const QByteArray &  value,
int  seconds 
)

Sets the key to hold the value.

If the key already holds a value, it is overwritten, regardless of its type.

◆ tableSize()

uint TSharedMemoryKvs::tableSize ( ) const

◆ unlock()

bool TSharedMemoryKvs::unlock ( )

Releases the lock on the shared memory segment.

Friends And Related Function Documentation

◆ TCacheSharedMemoryStore

friend class TCacheSharedMemoryStore
friend

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