(file) Return to CIMRepository.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Repository

Diff for /pegasus/src/Pegasus/Repository/CIMRepository.cpp between version 1.203 and 1.204

version 1.203, 2008/11/14 00:42:17 version 1.204, 2008/11/14 18:48:13
Line 63 
Line 63 
 #endif #endif
  
  
   //==============================================================================
   //
   // The class cache caches up PEGASUS_CLASS_CACHE_SIZE fully resolved class
   // definitions in memory.  To override the default, define
   // PEGASUS_CLASS_CACHE_SIZE in your build environment.  To suppress the cache
   // (and not compile it in at all), set PEGASUS_CLASS_CACHE_SIZE to 0.
   //
   //==============================================================================
   
   #if !defined(PEGASUS_CLASS_CACHE_SIZE)
   # define PEGASUS_CLASS_CACHE_SIZE 8
   #endif
   
   #if (PEGASUS_CLASS_CACHE_SIZE != 0)
   # define PEGASUS_USE_CLASS_CACHE
   #endif
   
   #define PEGASUS_QUALIFIER_CACHE_SIZE 80
   
   
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 71 
Line 91 
 { {
 public: public:
  
       CIMRepositoryRep()
           :
   #ifdef PEGASUS_USE_CLASS_CACHE
             _classCache(PEGASUS_CLASS_CACHE_SIZE),
   #endif /* PEGASUS_USE_CLASS_CACHE */
             _qualifierCache(PEGASUS_QUALIFIER_CACHE_SIZE)
       {
       }
   
     /**     /**
         Checks whether an instance with the specified key values exists in the         Checks whether an instance with the specified key values exists in the
         class hierarchy of the specified class.         class hierarchy of the specified class.
Line 106 
Line 135 
     RepositoryDeclContext* _context;     RepositoryDeclContext* _context;
  
     CString _lockFile;     CString _lockFile;
 };  
   
 // #define TEST_OUTPUT  
   
 //==============================================================================  
 //  
 // This is the class cache, which caches up PEGASUS_CLASS_CACHE_SIZE classes  
 // into memory. To override the default, define PEGASUS_CLASS_CACHE_SIZE in  
 // your environment. To supress the cache (and not compile it in at all)  
 // define PEGASUS_CLASS_CACHE_SIZE to 0.  
 //  
 //==============================================================================  
   
 #define PEGASUS_QUALIFIER_CACHE_SIZE 80  
   
 #if !defined(PEGASUS_CLASS_CACHE_SIZE)  
 # define PEGASUS_CLASS_CACHE_SIZE 8  
 #endif  
   
 #if (PEGASUS_CLASS_CACHE_SIZE != 0)  
 # define PEGASUS_USE_CLASS_CACHE  
 #endif  
  
 #ifdef PEGASUS_USE_CLASS_CACHE #ifdef PEGASUS_USE_CLASS_CACHE
 static ObjectCache<CIMClass> _classCache(PEGASUS_CLASS_CACHE_SIZE);      ObjectCache<CIMClass> _classCache;
 #endif /* PEGASUS_USE_CLASS_CACHE */ #endif /* PEGASUS_USE_CLASS_CACHE */
  
 static ObjectCache<CIMQualifierDecl>      ObjectCache<CIMQualifierDecl> _qualifierCache;
     _qualifierCache(PEGASUS_QUALIFIER_CACHE_SIZE);  };
  
 static String _getCacheKey( static String _getCacheKey(
     const CIMNamespaceName& nameSpace,     const CIMNamespaceName& nameSpace,
     const CIMName& entryName)     const CIMName& entryName)
 { {
     return nameSpace.getString() + ":" + entryName.getString();      String key = nameSpace.getString();
       key.append(':');
       key.append(entryName.getString());
       return key;
 } }
  
  
Line 849 
Line 859 
  
     String cacheKey = _getCacheKey(nameSpace, className);     String cacheKey = _getCacheKey(nameSpace, className);
  
     if (!_classCache.get(cacheKey, cimClass))      if (!_rep->_classCache.get(cacheKey, cimClass))
     {     {
         // Not in cache so load from disk:         // Not in cache so load from disk:
 #endif #endif
Line 875 
Line 885 
         {         {
             // Put in cache:             // Put in cache:
  
             _classCache.put(cacheKey, cimClass);              _rep->_classCache.put(cacheKey, cimClass);
         }         }
     }     }
 #endif #endif
Line 1083 
Line 1093 
  
 #ifdef PEGASUS_USE_CLASS_CACHE #ifdef PEGASUS_USE_CLASS_CACHE
  
     _classCache.evict(_getCacheKey(nameSpace, className));      _rep->_classCache.evict(_getCacheKey(nameSpace, className));
  
 #endif /* PEGASUS_USE_CLASS_CACHE */ #endif /* PEGASUS_USE_CLASS_CACHE */
  
Line 1315 
Line 1325 
     // Modifying this class may invalidate subclass definitions in the cache.     // Modifying this class may invalidate subclass definitions in the cache.
     // Since class modification is relatively rare, we just flush the entire     // Since class modification is relatively rare, we just flush the entire
     // cache rather than specifically evicting subclass definitions.     // cache rather than specifically evicting subclass definitions.
     _classCache.clear();      _rep->_classCache.clear();
  
 #endif /* PEGASUS_USE_CLASS_CACHE */ #endif /* PEGASUS_USE_CLASS_CACHE */
  
Line 2276 
Line 2286 
  
     // Check the cache first:     // Check the cache first:
  
     if (!_qualifierCache.get(qualifierCacheKey, qualifierDecl))      if (!_rep->_qualifierCache.get(qualifierCacheKey, qualifierDecl))
     {     {
         // Not in cache so load from disk:         // Not in cache so load from disk:
  
Line 2291 
Line 2301 
             if (!qualifierDecl.isUninitialized())             if (!qualifierDecl.isUninitialized())
             {             {
                 // Put in cache                 // Put in cache
                 _qualifierCache.put(qualifierCacheKey, qualifierDecl);                  _rep->_qualifierCache.put(qualifierCacheKey, qualifierDecl);
  
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 return qualifierDecl;                 return qualifierDecl;
Line 2333 
Line 2343 
  
     String qualifierCacheKey =     String qualifierCacheKey =
         _getCacheKey(nameSpace, qualifierDecl.getName());         _getCacheKey(nameSpace, qualifierDecl.getName());
     _qualifierCache.put(qualifierCacheKey, (CIMQualifierDecl&)qualifierDecl);      _rep->_qualifierCache.put(
           qualifierCacheKey, (CIMQualifierDecl&)qualifierDecl);
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
Line 2353 
Line 2364 
     _rep->_persistentStore->deleteQualifier(nameSpace, qualifierName);     _rep->_persistentStore->deleteQualifier(nameSpace, qualifierName);
  
     String qualifierCacheKey = _getCacheKey(nameSpace, qualifierName);     String qualifierCacheKey = _getCacheKey(nameSpace, qualifierName);
     _qualifierCache.evict(qualifierCacheKey);      _rep->_qualifierCache.evict(qualifierCacheKey);
  
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
 } }
Line 2604 
Line 2615 
     {     {
 #ifdef PEGASUS_USE_CLASS_CACHE #ifdef PEGASUS_USE_CLASS_CACHE
         cout << "Repository Class Cache Statistics:" << endl;         cout << "Repository Class Cache Statistics:" << endl;
         _classCache.DisplayCacheStatistics();          _rep->_classCache.DisplayCacheStatistics();
 #endif #endif
         cout << "Repository Qualifier Cache Statistics:" << endl;         cout << "Repository Qualifier Cache Statistics:" << endl;
         _qualifierCache.DisplayCacheStatistics();          _rep->_qualifierCache.DisplayCacheStatistics();
     }     }
 #endif #endif
  


Legend:
Removed from v.1.203  
changed lines
  Added in v.1.204

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2