def METHOD_NAME(func):
    @functools.wraps(func)
    def _decorator(project, text):
        if not settings.MDRENDER_CACHE_ENABLE:
            return func(project, text)
        # Avoid cache of too short texts
        if len(text) <= settings.MDRENDER_CACHE_MIN_SIZE:
            return func(project, text)
        sha1_hash = hashlib.sha1(force_bytes(text)).hexdigest()
        key = "mdrender/{}-{}".format(sha1_hash, project.id)
        # Try to get it from the cache
        cached = cache.get(key)
        if cached is not None:
            return cached
        returned_value = func(project, text)
        cache.set(key, returned_value, timeout=settings.MDRENDER_CACHE_TIMEOUT)
        return returned_value
    return _decorator