Create a cache profile in SharePoint using PowerShell

I have been looking for a way to create a new cache profile in SharePoint using Powershell. This profile can be used in the Page Output cache.
I noticed that cache profiles are stored in a list called “Cache Profiles” and implement the “Page Output Cache” content type.

So, creating a new profile shouldn’t be that difficult.

 

To add the profile to your Page Output Cache and enable the cache, you can use the following code: