Esempio n. 1
0
 def clearCache():
     Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)  
Esempio n. 2
0
            raise SmartHistoryLoadException(
                "Post attempt failed to SmartHistory with :" + str(e))
            return

        self.response.out.write(data)   

    @staticmethod
    def clearCache():
        Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)  

    #load the resource from smart history's server and then cache it
    #in the data store. If it is an image then cache it in the blob
    #store and store the blobkey in the data store
    @layer_cache.cache_with_key_fxn(
        lambda self: "smart_history_v%s_%s" % (
            Setting.smarthistory_version(), self.request.path_qs), 
        layer=layer_cache.Layers.Datastore, 
        expiration=SMARTHISTORY_CACHE_EXPIRATION_TIME, 
        persist_across_app_versions=True, 
        permanent_key_fxn=lambda self: "smart_history_permanent_%s" % (
            self.request.path_qs))
    def load_resource(self):
        path = self.request.path_qs

        #img is in users browser cache - we don't want to cache a
        #Not-Modified response otherwise people who don't have image
        #in browser cache won't get it
        headers = dict((k, v) for (k, v) in self.request.headers.iteritems()
                       if k not in ["If-Modified-Since", "If-None-Match",
                                    "Content-Length", "Host"])
Esempio n. 3
0
        except Exception, e:
            raise SmartHistoryLoadException(
                "Post attempt failed to SmartHistory with :" + str(e))
            return

        self.response.out.write(data)

    @staticmethod
    def clearCache():
        Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)

    #load the resource from smart history's server and then cache it in the data store
    #if it is an image then cache it in the blob store and store the blobkey in the data store
    @layer_cache.cache_with_key_fxn(
        lambda self: "smart_history_v%s_%s" %
        (Setting.smarthistory_version(), self.request.path_qs),
        layer=layer_cache.Layers.Datastore,
        expiration=SMARTHISTORY_CACHE_EXPIRATION_TIME,
        persist_across_app_versions=True,
        permanent_key_fxn=lambda self: "smart_history_permanent_%s" %
        (self.request.path_qs))
    def load_resource(self):
        path = self.request.path_qs

        #img is in users browser cache - we don't want to cache a Not-Modified response otherwise people who don't have image in browser cache won't get it
        headers = dict(
            (k, v) for (k, v) in self.request.headers.iteritems() if k not in
            ["If-Modified-Since", "If-None-Match", "Content-Length", "Host"])

        logging.info("getting resource " + str(path) + " from " +
                     SMARTHISTORY_URL)
Esempio n. 4
0
 def clearCache():
     Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)
Esempio n. 5
0
            else:
                raise SmartHistoryLoadException(response.status_code)
        except Exception, e:
            raise SmartHistoryLoadException("Post attempt failed to SmartHistory with :" + str(e))
            return

        self.response.out.write(data)

    @staticmethod
    def clearCache():
        Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)

    # load the resource from smart history's server and then cache it in the data store
    # if it is an image then cache it in the blob store and store the blobkey in the data store
    @layer_cache.cache_with_key_fxn(
        lambda self: "smart_history_v%s_%s" % (Setting.smarthistory_version(), self.request.path_qs),
        layer=layer_cache.Layers.Datastore,
        expiration=SMARTHISTORY_CACHE_EXPIRATION_TIME,
        persist_across_app_versions=True,
        permanent_key_fxn=lambda self: "smart_history_permanent_%s" % (self.request.path_qs),
    )
    def load_resource(self):
        path = self.request.path_qs

        # img is in users browser cache - we don't want to cache a Not-Modified response otherwise people who don't have image in browser cache won't get it
        headers = dict(
            (k, v)
            for (k, v) in self.request.headers.iteritems()
            if k not in ["If-Modified-Since", "If-None-Match", "Content-Length", "Host"]
        )