Provide interface for Cache methods for ease of testing

When I write unit tests for my code which invokes other code (like an external library), it’s nice for the other code to provide its functionality as an interface because I can abstract that bit away by using a mock of it in my unit tests and simply make assertions that certain methods on the mock were called.

Could we provide the cache methods (e.g. Get, Set, etc.) via an interface? This would make it a bit cleaner to write tests in this way.

Or is there a reason why the functionality is exposed via struct methods instead? If so, could we have this documented somewhere?