Storage Spaces Direct (S2D) uses 4GB of DRAM per 1TB of configured cache space on each node. This cache is useful only in hybrid storage configurations (SSD + HDD, NVMe + SSD or NVMe + HDD). If you implement an all-flash solution (only SSD or only NVMe) the cache is not enabled.
With regard to Cluster Shared Volumes (CSVs) a Block Cache can be configured. Microsoft recommends configuring 2GBs of CSV Block Cache or more.
When S2D is implemented using the dual-layer (disaggregated) model, almost all of the memory on the storage hosts can be used for caching.