SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
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() {
"accessLib", "Servername", "Username", "Password", "DatabaseName");
dBase.cacheManager(&cacheManager);
}
Manages connections with database servers.
Definition dbase.h:91
RWDBCacheManager * cacheManager() const
In memory metadata cache manager.
Definition memcache.h:58
static RWDBDatabase database(const RWCString &serverType, const RWCString &serverName, const RWCString &userName, const RWCString &password, const RWCString &databaseName, const RWDBDatabaseCallback &databasecb=RWDBDatabaseCallback())

Member Enumeration Documentation

◆ RemovalType

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::RWDBInMemoryCacheManager ( )
inline

Constructor.

◆ ~RWDBInMemoryCacheManager()

RWDBInMemoryCacheManager::~RWDBInMemoryCacheManager ( )

Destructor.

Member Function Documentation

◆ getStoredProc()

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.

◆ getTable()

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.

◆ removeAll()

void RWDBInMemoryCacheManager::removeAll ( RemovalType t = both)

Clears all entries from the cache of type t.

◆ setStoredProc()

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.

◆ setTable()

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 Symbol Documentation

◆ operator<< [1/2]

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

Saves the object cm to an RWFile.

◆ operator<< [2/2]

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

Saves the object cm to a virtual stream.

◆ operator>> [1/2]

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

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

◆ operator>> [2/2]

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

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

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