Exemplo n.º 1
0
def get_project_tasks(*vargs, **kwargs):
    """ cached version... """

    cachetime = kwargs.pop("cachetime", 300)
    cachename = "get_project_tasks" + str(hash(str(vargs))) + str(hash(str(kwargs)))

    return get(cachename, lambda: simpleasana.get_project_tasks(*vargs, **kwargs), cachetime, 10)
Exemplo n.º 2
0
        def cached_or_real(*vargs, **kwargs):
            """ this is returned, and then run. """

            cachetime = kwargs.pop("cachetime", 300)
            cachename = name + str(hash(str(vargs))) + str(hash(str(kwargs)))

            def realfunc():
                """ this is what actually gets called, if the value isn't
                    cached """
                return getattr(self.asana, name)(*vargs, **kwargs)

            return get(cachename, realfunc, cachetime, 10)
Exemplo n.º 3
0
def script_get(scriptname):
    ''' get a result from the cache, or if that's exired, then run the script
        for a new value '''

    result = simplegcache.get(scriptname, lambda: runscript(scriptname), 10)
    return jsonify(result)