def _addCache(self, section):
        """
        >>> m = ModularCacheConfig('test/bad4.ini')
        >>> m._addCache('dummy1')
        >>> cd = CacheDict.getInstance()
        >>> cd['dummy1'] #doctest: +ELLIPSIS
        <dummycache.DummyCache object at 0x...>
        """

        cd = CacheDict.getInstance()
        module = __import__(self._config._sections["Cache_" + str(section)]["module"].lower()).__dict__[
            self._config._sections["Cache_" + str(section)]["module"]
        ](self._config._sections["Cache_" + str(section)])

        cd[section] = module
Exemple #2
0
        def __cache(*args, **kwargs):
            """
            Sub sub decorator.
            """
            tmpArgs =[]

            cd = CacheDict.getInstance()

            if selector in cd:
                c = cd[selector]
                if c.isCached(fctn.__name__, *args, **kwargs):
                    return c.cached(fctn.__name__, *args, **kwargs)
                else:
                    return c.putInCache(fctn.__name__, fctn(*args, **kwargs), *args, **kwargs)
            else :
                return fctn(*args, **kwargs)