def wrapper(*args, **kwargs):
            name = utils._func_info(func, args)
            key = get_key(name, func_type, args, kwargs)
            value = cache.get(key)

            if value is None:
                value = func(*args, **kwargs)
                cache.set(key, value, timeout)

            return value
        def wrapper(*args, **kwargs):
            name = utils._func_info(func, args)
            key = get_key(name, func_type, args, kwargs)
            value = cache.get(key)

            if value is None:
                value = func(*args, **kwargs)
                # Try and set the key, value pair in the cache.
                # But if it fails on a Memcached Error handle it.
                try:
                    cache.set(key, value, timeout)
                except MemcachedError:
                    pass

            return value
 def invalidate(*args, **kwargs):
     name = utils._func_info(func, args)
     key = get_key(name, func_type, args, kwargs)
     cache.delete(key)