Exemplo n.º 1
0
 def __getitem__(self, key):
     self._key_check(key)
     try:
         value = Cache.__getitem__(self, key)
     except KeyError:
         try:
             value = self._second_gen[key]
         except KeyError:
             try:
                 value = self._get_item(key)
             except KeyError as ke3:
                 raise ke3
             else:
                 self.__setitem__(key, value)
         else:
             self.__setitem__(key, value)
             if key in self._second_gen:   # the second gen clean up could be triggered during set in first gen
                 del self._second_gen[key]
     else:
         self._update_order(key)
     return value
Exemplo n.º 2
0
 def __getitem__(self, key):
     self._key_check(key)
     try:
         value = Cache.__getitem__(self, key)
     except KeyError:
         try:
             value = self._second_gen[key]
         except KeyError:
             try:
                 value = self._get_item(key)
             except KeyError as ke3:
                 raise ke3
             else:
                 self.__setitem__(key, value)
         else:
             self.__setitem__(key, value)
             if key in self._second_gen:   # the second gen clean up could be triggered during set in first gen
                 del self._second_gen[key]
     else:
         self._update_order(key)
     return value
Exemplo n.º 3
0
Arquivo: drain.py Projeto: IBM/Drain3
 def get(self, key):
     """
     Returns the value of the item with the specified key without updating
     the cache eviction algorithm.
     """
     return Cache.__getitem__(self, key)