beforeInvocation<T> method
Executed immediately before the target method invocation.
May perform any synchronous or asynchronous operation.
Parameters
invocation: The currentMethodInvocationrepresenting the call context.
Returns
A FutureOr<void> indicating completion of pre-invocation tasks.
Implementation
@override
FutureOr<void> beforeInvocation<T>(MethodInvocation<T> invocation) async {
// Pre-eviction: CacheEvict with beforeInvocation = true
final cacheEvict = invocation.getMethod().getDirectAnnotation<CacheEvict>();
if (cacheEvict != null && cacheEvict.beforeInvocation) {
final operation = CacheEvictOperation(cacheEvict);
final context = _getOrCreate().withInvocation(invocation);
await operation.execute(context);
}
}