SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions | Friends
RWDBInMemoryCacheManager Class Reference

In memory metadata cache manager. More...

#include <rw/db/memcache.h>

Inheritance diagram for RWDBInMemoryCacheManager:
RWDBCacheManager

Public Types

enum  RemovalType { table, storedProc, both }
 

Public Member Functions

 RWDBInMemoryCacheManager ()
 
 ~RWDBInMemoryCacheManager ()
 
RWDBStoredProcEntry getStoredProc (const RWCString &key) const
 
RWDBTableEntry getTable (const RWCString &key) const
 
void removeAll (RemovalType t=both)
 
void setStoredProc (const RWCString &key, const RWDBStoredProcEntry &entry)
 
void setTable (const RWCString &key, const RWDBTableEntry &entry)
 
- Public Member Functions inherited from RWDBCacheManager
virtual ~RWDBCacheManager ()
 

Friends

RWFileoperator<< (RWFile &file, const RWDBInMemoryCacheManager &cm)
 
RWvostreamoperator<< (RWvostream &strm, const RWDBInMemoryCacheManager &cm)
 
RWFileoperator>> (RWFile &file, RWDBInMemoryCacheManager &cm)
 
RWvistreamoperator>> (RWvistream &strm, RWDBInMemoryCacheManager &cm)
 

Additional Inherited Members

- Protected Member Functions inherited from RWDBCacheManager
 RWDBCacheManager ()
 
 RWDBCacheManager (const RWDBCacheManager &)
 

Detailed Description

RWDBInMemoryCacheManager is an in-memory implementation for caching of schema metadata.

Install an instance of RWDBInMemoryCacheManager in an instance of RWDBDatabase. The metadata of the objects produced by that RWDBDatabase instance will be cached. An RWDBInMemoryCacheManager instance may not be shared amongst multiple RWDBDatabase objects. If you need to access the currently installed cache manager, acquire the lock to the RWDBDatabase and then release it when done via the methods RWDBDatabase::acquire() and RWDBDatabase::release(). The cache manager must remain in scope for the lifetime of the RWDBDatabase instance in which it is installed.

Please refer to the DB Interface Module User's Guide and the applicable DB Access Module User's Guide for more information on caching metadata.

Synopsis
#include <rw/db/memcache.h>
int main()
{
RWDBDatabase dBase =
RWDBManager::database("accessLib", "Servername", "Username", "Password", "DatabaseName");
dBase.cacheManager(&cacheManager);
}

Member Enumeration Documentation

Types allowed for removeAll().

Enumerator
table 

Remove metadata cached for any and all tables.

storedProc 

Remove metadata cached for any and all stored procedures.

both 

Remove metadata cached for any and all tables and stored procedures.

Constructor & Destructor Documentation

RWDBInMemoryCacheManager::RWDBInMemoryCacheManager ( )
inline

Constructor.

RWDBInMemoryCacheManager::~RWDBInMemoryCacheManager ( )

Destructor.

Member Function Documentation

RWDBStoredProcEntry RWDBInMemoryCacheManager::getStoredProc ( const RWCString key) const
virtual

This method is called whenever we need any stored procedure metadata from the cache. If the key is not in the cache, this method returns an empty RWDBStoredProcEntry. The key is the return value of RWDBStoredProc::name().

The default implementation returns an empty RWDBStoredProcEntry.

Reimplemented from RWDBCacheManager.

RWDBTableEntry RWDBInMemoryCacheManager::getTable ( const RWCString key) const
virtual

This method is called whenever we need any table metadata from the cache. If the key is not in the cache, this method returns an empty RWDBTableEntry. The key is the return value of RWDBTable::name().

The default implementation returns an empty RWDBTableEntry.

Reimplemented from RWDBCacheManager.

void RWDBInMemoryCacheManager::removeAll ( RemovalType  t = both)

Clears all entries from the cache of type t.

void RWDBInMemoryCacheManager::setStoredProc ( const RWCString key,
const RWDBStoredProcEntry spEntry 
)
virtual

This method is called whenever we have fetched any stored procedure metadata from the database and need to cache it. The key is the return value of RWDBStoredProc::name(), and the spEntry contains all stored procedure metadata.

The default implementation is a no-op.

Reimplemented from RWDBCacheManager.

void RWDBInMemoryCacheManager::setTable ( const RWCString key,
const RWDBTableEntry tableEntry 
)
virtual

This method is called whenever we have fetched any table metadata from the database and need to cache it. The key is the return value of RWDBTable::name(), and the tableEntry contains all table metadata.

The default implementation is a no-op.

Reimplemented from RWDBCacheManager.

Friends And Related Function Documentation

RWFile& operator<< ( RWFile file,
const RWDBInMemoryCacheManager cm 
)
friend

Saves the object cm to an RWFile.

RWvostream& operator<< ( RWvostream strm,
const RWDBInMemoryCacheManager cm 
)
friend

Saves the object cm to a virtual stream.

RWFile& operator>> ( RWFile file,
RWDBInMemoryCacheManager cm 
)
friend

Restores an RWDBInMemoryCacheManager into cm from an RWFile, replacing the previous contents of cm.

RWvistream& operator>> ( RWvistream strm,
RWDBInMemoryCacheManager cm 
)
friend

Restores an RWDBInMemoryCacheManager into cm from a virtual stream, replacing the previous contents of cm.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.