A good way to reduce the amount of allocations would be to switch from Task<T> to ValueTask<T>.
In theory (and in practice, at least on a couple of projects where I tested it) there should be no change in code already using FusionCache, at least if that code is not doing something esoteric.
When calling async methods by using the standard await keyword the changes required are effectively none.
A good way to reduce the amount of allocations would be to switch from
Task<T>
toValueTask<T>
.In theory (and in practice, at least on a couple of projects where I tested it) there should be no change in code already using FusionCache, at least if that code is not doing something esoteric.
When calling async methods by using the standard
await
keyword the changes required are effectively none.More info here https://blog.marcgravell.com/2019/08/prefer-valuetask-to-task-always-and.html , with the great Marc Gravell explaining everything way better than me.
Opinions?