Example #1
0
 def SetMulti(self, mapping):
     try:
         memcache.Client().set_multi_async(mapping,
                                           namespace=self._namespace)
     except ValueError as e:
         logging.error('Caught "ValueError: %s" when mapping keys %s' %
                       (e, mapping.keys()))
Example #2
0
 def SetMulti(self, mapping):
     # talking_alarm_clock always fails because the zip is too big.
     # TODO(kalman): store example zips in blobstore.
     if any(
             key.find('talking_alarm_clock') != -1
             for key in mapping.iterkeys()):
         return
     try:
         memcache.Client().set_multi_async(mapping,
                                           namespace=self._namespace)
     except ValueError as e:
         logging.error('Caught "ValueError: %s" when mapping keys %s' %
                       (e, mapping.keys()))
Example #3
0
    def SetMulti(self, mapping):
        # Some files are too big to fit in memcache, and will throw a ValueError if
        # we try. That's caught below, but to avoid log spew as much as possible
        # (and to try to store as many things as possible, since this is Set*Multi*
        # after all, and there may be other things to store from |mapping|), delete
        # the paths which we know don't work.
        #
        # TODO(kalman): Store big things (like example zips) in blobstore so that
        # this doesn't happen.
        log_spewers = ('assets/remote-debugging/remote-debug-banner.ai', )
        for spewer in log_spewers:
            mapping.pop(spewer, None)

        try:
            rpc = memcache.Client().set_multi_async(mapping,
                                                    namespace=self._namespace)
            return Future(callback=rpc.get_result)
        except ValueError as e:
            logging.error('Caught error when memcache-ing keys %s: %s' %
                          (mapping.keys(), traceback.format_exc()))
            return Future(value=None)
Example #4
0
 def GetMulti(self, keys):
     rpc = memcache.Client().get_multi_async(keys,
                                             namespace=self._namespace)
     return _AsyncMemcacheGetFuture(rpc)
Example #5
0
 def SetMulti(self, mapping, time=CACHE_TIMEOUT):
     memcache.Client().set_multi_async(mapping,
                                       namespace=self._namespace,
                                       time=time)
Example #6
0
 def GetMulti(self, keys):
     rpc = memcache.Client().get_multi_async(keys,
                                             namespace=self._namespace)
     return Future(callback=rpc.get_result)
 def GetMulti(self, keys, namespace, time=CACHE_TIMEOUT):
     rpc = memcache.Client().get_multi_async(keys, namespace=namespace)
     return _AsyncMemcacheGetFuture(rpc)