LMIShellCache

class lmi.shell.LMIShellCache.LMIClassCacheEntry(cim_class, full_fetch)[source]

Class used for storing wbem.CIMClass in LMIShellCache.

Parameters:
  • cim_class (CIMClass) – wbem.CIMClass to cache
  • full_fetch (bool) – True, if class is cached with qualifiers
class lmi.shell.LMIShellCache.LMIShellCache(active=True, classname_dict=None, class_dict=None, class_superclass_dict=None)[source]

Class representing a LMIShell cache.

Parameters:
  • active (bool) – specifies, if the cache is active
  • classname_list (list) – list of strings of cached class names
  • class_dict (dictionary) – cached wbem.CIMClass objects, where the key is the class name and value is CIMClass object
  • class_superclass_dict (dictionary) – dictionary, where the key is namespace and value is dictionary of classname:superclass
active[source]
Returns:True, if the cache is active; False otherwise
add_class(cim_class, namespace=u'root/cimv2', full_fetch=False)[source]

Stores a new wbem.CIMClass object into the cache.

Parameters:
  • cim_class (CIMClass) – wbem.CIMClass object
  • namespace (string) – namespace storing cached classes
add_superclass(classname, superclass, namespace)[source]

Stores a new pair classname : superclassname into the cache.

Parameters:
  • classname (string) – class name to be stored
  • superclass (string) – super class name to be stored
  • namespace (string) – namespace name of the classname
clear()[source]

Clears the cache.

get_class(classname, namespace=u'root/cimv2')[source]
Parameters:
  • classname (string) – cached class name
  • namespace (string) – namespace storing cached classes
Returns:

cache object, if proper class name provided, None otherwise

Return type:

LMIClassCacheEntry

get_classes(namespace=u'root/cimv2')[source]
Parameters:namespace (string) – namespace storing cached classes
Returns:list of cached class names or None, if no cached classes is stored
get_superclass(classname, namespace)[source]
Parameters:
  • classname (string) – cached class name
  • namespace (string) – namespace name
Returns:

cached superclass to the given class name

Return type:

string

has_superclass(classname, namespace)[source]
Parameters:
  • classname (string) – cached class name
  • namespace (string) – namespace name
Returns:

True, if the cache contains superclass to the given class name; False otherwise

set_classes(classname_list, namespace=u'root/cimv2')[source]

Stores a new class names’ list.

Parameters:namespace (string) – namespace storing cached classes