Example #1
0
    def submit(self, params):
        hash_value = md5()
        hash_value.update(str(params))
        cache_key = create_cache_key('topology_cache_key+' + self.__class__.__name__ + hash_value.digest())
        data = self.cache_engine.get(cache_key)
        hit = False if data is None else True
        self._execution_plan.add_phase(self, "submit", {'topology_cache_hit': hit})
        if not hit:
            self.logger.debug('Topology cache miss, cache_key: {0}'.format(cache_key))
            data = self._submit(params)
            cache_params = {'key': cache_key, 'value': data}
            #in case there is a ttl
            cache_params['ttl'] = self._topology_cache_ttl
            self.cache_engine.put(**cache_params)

        else:
            self.logger.debug('Topology cache hit, cache_key: {0}'.format(cache_key))
        return data
Example #2
0
    def submit(self, params):
        hash_value = md5()
        hash_value.update(str(params))
        cache_key = create_cache_key('topology_cache_key+' +
                                     self.__class__.__name__ +
                                     hash_value.digest())
        data = self.cache_engine.get(cache_key)
        hit = False if data is None else True
        self._execution_plan.add_phase(self, "submit",
                                       {'topology_cache_hit': hit})
        if not hit:
            self.logger.debug(
                'Topology cache miss, cache_key: {0}'.format(cache_key))
            data = self._submit(params)
            cache_params = {'key': cache_key, 'value': data}
            # in case there is a ttl
            cache_params['ttl'] = self._topology_cache_ttl
            self.cache_engine.put(**cache_params)

        else:
            self.logger.debug(
                'Topology cache hit, cache_key: {0}'.format(cache_key))
        return data
Example #3
0
 def _get_cache_key(data_source_name, execution_plan):
     return create_cache_key(data_source_name + execution_plan)
Example #4
0
 def _get_cache_key(data_source_name, execution_plan):
     return create_cache_key(data_source_name + execution_plan)