def cache(self, key_prefix=None, expire=None, include_self=False):
        def decorator(f):
            argspec = inspect.getargspec(f)
            if argspec and argspec[0] and argspec[0][0] in ('self', 'cls'):
                has_self = True
            else:
                has_self = False

            @functools.wraps(f)
            def wrapper(*args, **kwargs):
                cache_args = args
                # handle self and cls
                if has_self:
                    if not include_self:
                        cache_args = args[1:]
                cache_key = generate_key_for_cached_func(
                    key_prefix, f, *cache_args, **kwargs)
                if self._running_mode == BATCH_MODE:
                    promise = Promise()
                    self._pending_operations.append(
                        (f, args, kwargs, promise, cache_key, expire))
                    return promise
                rv = self._raw_get(cache_key)
                if rv is None:
                    value = f(*args, **kwargs)
                    self.set(cache_key, value, expire)
                    rv = self.serializer.dumps(value)
                return self.serializer.loads(rv)

            wrapper.__rc_cache_params__ = {
                'key_prefix': key_prefix,
                'expire': expire,
                'include_self': include_self,
            }
            return wrapper
        return decorator
Test ZAxisInfeedRateStmt factory method
dataset/ETHPy150Open fengsp/rc/rc/cache.py/BaseCache.cache--crossover with--dataset/ETHPy150Open curtacircuitos/pcb-tools/gerber/tests/test_excellon_statements.py/test_z_axis_infeed_rate_factory