Example #1
0
 def prepareCachingTransaction():
   if cached_list.isCachedListExists(data_id):
     if cached_list.isProcessing(data_id):
       return False
     else:
       cached_list.setProcessing(data_id)
       return True
   else:
     cached_list.createEmptyProcessingList(data_id)
     return True
Example #2
0
 def prepareCachingTransaction():
     if cached_list.isCachedListExists(data_id):
         if cached_list.isProcessing(data_id):
             return False
         else:
             cached_list.setProcessing(data_id)
             return True
     else:
         cached_list.createEmptyProcessingList(data_id)
         return True
Example #3
0
  def getListData(self, list_id, query, start=None, limit=50):
    """See ListDataReader.getListData for specification."""
    data_id = getDataId(query)
    if cached_list.isCachedListExists(data_id):
      if cached_list.isValid(data_id):
        return ListData(cached_list.getCachedItems(data_id), FINAL_BATCH)
      else:
        if not cached_list.isProcessing(data_id):
          self._start_caching(list_id, data_id, query)

        # return None because cache is not hit
        return None

    else:
      self._start_caching(list_id, data_id, query)

      # return None because cache is not hit
      return None
Example #4
0
    def getListData(self, list_id, query, start=None, limit=50):
        """See ListDataReader.getListData for specification."""
        data_id = getDataId(query)
        if cached_list.isCachedListExists(data_id):
            if cached_list.isValid(data_id):
                return ListData(cached_list.getCachedItems(data_id),
                                FINAL_BATCH)
            else:
                if not cached_list.isProcessing(data_id):
                    self._start_caching(list_id, data_id, query)

                # return None because cache is not hit
                return None

        else:
            self._start_caching(list_id, data_id, query)

            # return None because cache is not hit
            return None
Example #5
0
 def testIsProcessing(self):
     """Tests isProcessing function."""
     self.assertTrue(cached_list_logic.isProcessing(
         self.processing_list_id))
     self.assertFalse(
         cached_list_logic.isProcessing(self.not_processing_list_id))
Example #6
0
 def testIsProcessing(self):
   """Tests isProcessing function."""
   self.assertTrue(cached_list_logic.isProcessing(self.processing_list_id))
   self.assertFalse(
       cached_list_logic.isProcessing(self.not_processing_list_id))