00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 2002 Net Integration Technologies, Inc. 00004 * 00005 * A UniConf generator that stores keys in memory. 00006 */ 00007 #ifndef __UNICACHEGEN_H 00008 #define __UNICACHEGEN_H 00009 00010 #include "unitempgen.h" 00011 #include "uniconftree.h" 00012 #include "wvlog.h" 00013 00014 /** 00015 * A UniConf generator that adds a cache layer on top of another generator 00016 * 00017 * This cache implementation preloads the entire uniconf tree and then keeps up 00018 * to date by making changes whenever notifications are recieved. This means 00019 * that a uniconfclient when cached will never actively contact the 00020 * uniconfdaemon. 00021 * 00022 * **WARNING** 00023 * The cache *will* go out of date if used with a uniconfclient/daemon without 00024 * running a select loop. 00025 */ 00026 class UniCacheGen : public UniTempGen 00027 { 00028 protected: 00029 WvLog log; 00030 UniConfGen *inner; 00031 00032 void loadtree(const UniConfKey &key = ""); 00033 void deltacallback(const UniConfKey &key, WvStringParm value, 00034 void *userdata); 00035 00036 public: 00037 UniCacheGen(UniConfGen *_inner); 00038 virtual ~UniCacheGen(); 00039 00040 /***** Overridden members *****/ 00041 virtual void set(const UniConfKey &key, WvStringParm value); 00042 }; 00043 00044 #endif // __UNICACHEGEN_H