eg:
class Service1(object):
name = 'service1'
# Initialize Dependencies
inferservice_rpc = RpcProxy('inferservice')
config = Config()
storage = Storage()
@event_handler('etc', 'mg_results')
def infer(self, message):
uuid = message['uuid']
tenant_id = message['tenant_id']
parameters = message['parameters']
r = self.getCachedRecommender(tenant_id)
...
@lru_cache(maxsize=1)
def getCachedRecommender(self, tenant_id):
LOG.debug("Looking for tenant_id: {}".format(tenant_id))
return self._get_recommender(tenant_id)
I tried it… but it seems like i get a new cache instance every time… meaning… i keep seeing the debug message. in getCachedRecommender()
I tested a simple class with above logic and it works fine but not in nameko.