682 return self._type_cache[eid] |
682 return self._type_cache[eid] |
683 except KeyError: |
683 except KeyError: |
684 etype = self.system_source.eid_type(cnx, eid) |
684 etype = self.system_source.eid_type(cnx, eid) |
685 self._type_cache[eid] = etype |
685 self._type_cache[eid] = etype |
686 return etype |
686 return etype |
687 |
|
688 def querier_cache_key(self, cnx, rql, args, eidkeys): |
|
689 cachekey = [rql] |
|
690 for key in sorted(eidkeys): |
|
691 try: |
|
692 etype = self.type_from_eid(args[key], cnx) |
|
693 except KeyError: |
|
694 raise QueryError('bad cache key %s (no value)' % key) |
|
695 except TypeError: |
|
696 raise QueryError('bad cache key %s (value: %r)' % ( |
|
697 key, args[key])) |
|
698 cachekey.append(etype) |
|
699 # ensure eid is correctly typed in args |
|
700 args[key] = int(args[key]) |
|
701 return tuple(cachekey) |
|
702 |
687 |
703 def add_info(self, cnx, entity, source): |
688 def add_info(self, cnx, entity, source): |
704 """add type and source info for an eid into the system table, |
689 """add type and source info for an eid into the system table, |
705 and index the entity with the full text index |
690 and index the entity with the full text index |
706 """ |
691 """ |